Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
abouzarnouri authored Jan 28, 2017
1 parent dd99cdc commit 9a5aa05
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
Hello World!
AutoRefreshingCache is implemeted in C#. It provides a MemoryCache which tries to refresh hot values before
actual expiration time is reached. It gives you a single public method (i.e. GET).
Here comes the pseudocode of this cache.


get(param)
res = cache.get(param)
if (res == null)
refresh(param, null)
return cache.get(param)
if (res needs to be refresh)
res.refreshWorkers.increment
if (res.refreshWorkers == 1)
task.run(() => refresh(param, res.refreshWorkers))
return res.data


refresh(param, refreshWorkers)
data = calc(param)
cache.put(key:param, value:{data, now}, expiration:exp_time)
if (refreshWorkers != null)
refreshWorkers.decrement

0 comments on commit 9a5aa05

Please sign in to comment.