Ernest Nguyen Hung
Ernest Nguyen Hung
Introduce new struct `Metrics` containing simple metrics (hits, misses, insertions, deletions and evictions). Extend an API by adding `Metrics` method returning `Cache` (or `Sharded`) metrics.
Although `imcache` supports entry `ttl`, it doesn't support policy evicting the entries by their expiration (ttl) timestamp (currently supported policies: `lru`, `lfu` and `rand`). Add the new eviction policy `EvictionPolicyTTL`....
Add `GetAndRemove` to `Cache` and `Sharded`, it should atomically get the value under a given key and remove it from the cache.
To test the eviction callback functionality the following mock struct is used https://github.com/erni27/imcache/blob/master/imcache_test.go#L1018. Since the eviction callbacks are invoked in the separate goroutine(s), the assertion methods should wait _reasonable_ amount...
Add a new README section with brief comparison between `imcache` and other in-memory cache libraries. It would help users looking for an in-memory cache library to better understand if `imcache`...