You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
948 B

  1. // Package lru provides three different LRU caches of varying sophistication.
  2. //
  3. // Cache is a simple LRU cache. It is based on the
  4. // LRU implementation in groupcache:
  5. // https://github.com/golang/groupcache/tree/master/lru
  6. //
  7. // TwoQueueCache tracks frequently used and recently used entries separately.
  8. // This avoids a burst of accesses from taking out frequently used entries,
  9. // at the cost of about 2x computational overhead and some extra bookkeeping.
  10. //
  11. // ARCCache is an adaptive replacement cache. It tracks recent evictions as
  12. // well as recent usage in both the frequent and recent caches. Its
  13. // computational overhead is comparable to TwoQueueCache, but the memory
  14. // overhead is linear with the size of the cache.
  15. //
  16. // ARC has been patented by IBM, so do not use it if that is problematic for
  17. // your program.
  18. //
  19. // All caches in this package take locks while operating, and are therefore
  20. // thread-safe for consumers.
  21. package lru