Skip to content

Commit 66368af

Browse files
committed
Update README.md
1 parent 47ef5f5 commit 66368af

File tree

1 file changed

+47
-15
lines changed

1 file changed

+47
-15
lines changed

README.md

+47-15
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Note that the implementation of algorithm support two interaction modes:
3131

3232
But actually nothing forbidens to interact in both modes at same time.
3333

34+
Both types of interface developed to IPACR (Interaction Protocol of Algorithms Cache Replacement) conformance.
35+
3436

3537
##### note №2:
3638
Note that the implementation of algorithm stores keys in binary, that is, for set of keys from the first example bellow key will be stored as in second example:
@@ -187,14 +189,16 @@ max key size
187189
internal - erlang interface for inner interaction in Erlang node
188190
external - outside interface for interaction from the world outside
189191

192+
###### Both types of interface developed to IPACR (Interaction Protocol of Algorithms Cache Replacement) conformance.
193+
190194
#### put key
191195
###### internal:
192196

193197
lfu:point(K).
194198

195199
###### external:
196200

197-
POINT:key %% "OK"
201+
POINT:key %% "OK"
198202

199203
#### get counter on key
200204
###### internal:
@@ -203,7 +207,7 @@ max key size
203207

204208
###### external:
205209

206-
COUNT:key %% "NUMBER"
210+
COUNT:key %% "NUMBER"
207211

208212
#### get offset counter and counter all keys
209213
###### internal:
@@ -212,7 +216,7 @@ max key size
212216

213217
###### external:
214218

215-
STATE %% JSON: "{O:NUMBER,Q:NUMBER}"
219+
STATE %% JSON: "{O:NUMBER,Q:NUMBER}"
216220

217221
#### store algorithm state to disk
218222
###### Please pay attantion, 'store' call executes asynchronously!
@@ -222,7 +226,7 @@ max key size
222226

223227
###### external:
224228

225-
STORE %% "OK"
229+
STORE %% "OK"
226230

227231
#### execute scoring of offset counter
228232
###### internal:
@@ -231,53 +235,81 @@ max key size
231235

232236
###### external:
233237

234-
SCORE %% "READY"
238+
SCORE %% "READY"
235239

236240
#### execute scoring of offset counter and get keys by it into internal table
237241
###### internal:
238242
###### Please pay attantion, that exist of internal table expires after following request to fetching 'fetch/0' or to clean 'clean/0'!
239243

240-
T = lfu:fetch(). %% tid()
244+
T = lfu:fetch(). %% tid()
241245
ets:tab2list(T).
242246

243247
###### external:
244248

245-
FETCH %% JSON: "[{number1:[key1,key2,key3]},{number2:[key1,key2,key3]},{number3:[key1,key2,key3]},...]"
249+
FETCH %% JSON: "[{number1:[key1,key2,key3]},{number2:[key1,key2,key3]},{number3:[key1,key2,key3]},...]"
246250

247251
#### execute scoring of offset counter and get keys by it into external table
248252
###### Please pay attantion, that it`s preferably using interface with internal table 'fetch/0', because it ensures a data consistency with your system!
249253
###### internal:
250254

251-
T = ets:new(stub,[ %% tid()
255+
T = ets:new(stub,[ %% tid()
252256
bag,public,{write_concurrency,true},
253257
{decentralized_counters,true}
254258
]).
255259
lfu:fetch(T).
256260
ets:tab2list(T).
257261

258-
#### execute scoring of offset counter and get keys by it into internal table for follow delete
262+
#### execute scoring of offset counter and get keys by it into internal table for follow delete (support both interaction types)
263+
##### without confirm
264+
###### internal:
265+
###### Please pay attantion, that exist of internal table expires after following request to fetching 'fetch/0' or to clean 'clean/0'!
266+
267+
T = lfu:clean(). %% tid()
268+
or
269+
T = lfu:clean(async). %% tid()
270+
271+
###### external:
272+
273+
CLEAN %% JSON: "[{number1:[key1,key2,key3]},{number2:[key1,key2,key3]},{number3:[key1,key2,key3]},...]"
274+
or
275+
CLEAN:ASYNC %% JSON: "[{number1:[key1,key2,key3]},{number2:[key1,key2,key3]},{number3:[key1,key2,key3]},...]"
276+
277+
##### with confirm
259278
###### internal:
260279
###### Please pay attantion, that exist of internal table expires after following request to fetching 'fetch/0' or to clean 'clean/0'!
261280

262-
{T,R} = lfu:clean(). %% {tid(),ref()}
281+
{T,R} = lfu:clean(sync). %% {tid(),ref()}
263282
lfu:clean(R,T).
264283

265284
###### external:
266285

267-
CLEAN %% JSON: "{[{number1:[key1,key2,key3]},{number2:[key1,key2,key3]},{number3:[key1,key2,key3]},...]:UNIQ_REF}"
268-
CLEAN:UNIQ_REF %% OK
286+
CLEAN:SYNC %% JSON: "{[{number1:[key1,key2,key3]},{number2:[key1,key2,key3]},{number3:[key1,key2,key3]},...]:UNIQ_REF}"
287+
CLEAN:UNIQ_REF %% OK
269288

270-
#### execute scoring of offset counter and get keys by it into external table for follow delete
289+
#### execute scoring of offset counter and get keys by it into external table for follow delete (support only internal interaction type)
271290
###### Please pay attantion, that it`s preferably using interface with internal table 'clean/0', because it ensures a data consistency with your system!
291+
##### without confirm
292+
###### internal:
293+
294+
T = ets:new(stub,[ %% tid()
295+
bag,public,{write_concurrency,true},
296+
{decentralized_counters,true}
297+
]).
298+
T = lfu:clean(T). %% ref()
299+
or
300+
T = lfu:clean(async,T). %% ref()
301+
302+
##### with confirm
272303
###### internal:
273304

274-
T = ets:new(stub,[ %% tid()
305+
T = ets:new(stub,[ %% tid()
275306
bag,public,{write_concurrency,true},
276307
{decentralized_counters,true}
277308
]).
278-
R = lfu:clean(T). %% ref()
309+
{T,R} = lfu:clean(sync,T). %% ref()
279310
lfu:clean(R,T).
280311

312+
281313
#### put list keys with conters
282314
###### initialization of state, for example, transfer of state from other implementation 'lfu'
283315
###### internal:

0 commit comments

Comments
 (0)