doc.go 1.1 KB

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