github.com/auttaja/go-tlru@v0.0.0-20200823214418-2a1d18ce6d93/README.md (about) 1 # go-tlru 2 An implementation of the [Time Aware Least Recent Used (TLRU)](https://arxiv.org/pdf/1801.00390.pdf) caching type for Go. 3 4 To start with this library, simply create a new cache with `NewCache(MaxLength, MaxBytes int, Duration time.Duration)`. The first argument specifies the max number of items which can be in the cache, the second argument defines the maximum number of bytes the cache can be (0 means infinite), and the third argument defines how long arguments will last roughly before they are purged. From here, the cache has 2 functions: 5 - `Get(Key interface{}) (item interface{}, ok bool)`: Gets the item from the cache by the key interface which was given. The ok boolean defines if it was in the cache and therefore was successfully fetched. 6 - `Set(Key, Value interface{})`: Adds an item with the specified key/value to the cache.