From 378662d53fa5db3a60dc2c008fd6f434fc5ea76a Mon Sep 17 00:00:00 2001 From: Matt Keller Date: Mon, 9 Mar 2015 08:23:46 -0400 Subject: [PATCH] Readme update --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 5c14e66..a64d822 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,15 @@ cache can be saved to and loaded from a file (using `c.Items()` to retrieve the items map to serialize, and `NewFrom()` to create a cache from a deserialized one) to recover from downtime quickly. (See the docs for `NewFrom()` for caveats.) +When creating a cache object using `NewWithLRU()`, if you set the maxItems value +above 0, the LRU functionality is enabled. The cache automatically updates a +timestamp every time a given item is retrieved. In the background, the janitor takes +care of deleting items that have expired because of staleness, or are +least-recently-used when the cache is under pressure. Whatever you set your purge +interval to controls when the item will actually be removed from the cache. If you +don't want to use the janitor, and wish to manually purge LRU items, then +`c.DeleteLRU(n)` where `n` is the number of items you'd like to purge. + ### Installation `go get github.com/pmylund/go-cache`