diff --git a/README.md b/README.md index 536e586..ebf9371 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,12 @@ either using LRC or LRU eviction. run cache.DeleteExpired periodically using [time.Ticker](https://golang.org/pkg/time/#Ticker), advisable period is 1/2 of TTL. -This cache is heavily inspired by [hashicorp/golang-lru](https://github.com/hashicorp/golang-lru) _simplelru_ implementation. +This cache is heavily inspired by [hashicorp/golang-lru](https://github.com/hashicorp/golang-lru) _simplelru_ implementation. Key differences are: + +- Support LRC (Least Recently Created) in addition to LRU and TTL-based eviction +- Supports per-key TTL setting +- Doesn't spawn any goroutines, whereas `hashicorp/golang-lru/v2/expirable` spawns goroutine which is never killed ([as of now](https://github.com/hashicorp/golang-lru/issues/159)) +- Provides stats about hits and misses, added and evicted entries ### Usage example diff --git a/cache_test.go b/cache_test.go index 71ddce1..dd0aac5 100644 --- a/cache_test.go +++ b/cache_test.go @@ -133,7 +133,7 @@ func TestCacheInvalidateAndEvict(t *testing.T) { } func TestCacheBadOption(t *testing.T) { - lc, err := NewCache(func(lc *cacheImpl) error { + lc, err := NewCache(func(_ *cacheImpl) error { return fmt.Errorf("mock err") }) assert.EqualError(t, err, "failed to set cache option: mock err")