forked from abouzarnouri/Auto-Refreshing-Cache
-
Notifications
You must be signed in to change notification settings - Fork 0
AmirRaptoR/Auto-Refreshing-Cache
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
AutoRefreshingCache is a MemoryCache which tries to refresh its hot entries before their actual expiration time is reached. This class gives you a single public method (i.e. GET). Here comes the pseudocode. get(param) result = cache.get(param) if (result == null) refresh(param, null) return cache.get(param) if (result needs to be refreshed) result.refreshWorkers.increment if (result.refreshWorkers == 1) run refresh(param, res.refreshWorkers) in a new thread return res.data refresh(param, refreshWorkers) data = calc(param) cache.add(key:param, value:data, expiration:exp_time) if (refreshWorkers != null) refreshWorkers.decrement
About
A MemoryCache which tries to prevent cache miss for hot entries, by refreshing before expiration.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- C# 100.0%