expirable-cache
expirable-cache copied to clipboard
Expirable Go LRC\LRU cache without goroutines
Improve performance in frequently used cache methods: 1. Values method: - Move time.Now() outside of lock - Simplify iteration 2. DeleteExpired method: - Replace key slice allocation with direct list...
The hashicorp lru.Cache implementation (https://github.com/hashicorp/golang-lru/blob/main/lru.go) contains a few other functions which are useful. I'm not sure why they don't include them in the simplelru or expirablelru implementations. In particular, the...
Replace time.Time with int64 nanotime values for expiration tracking, simplifying TTL checks and reducing memory footprint. 19-30% faster. Performance improvements (benchstat with n=3 on Apple M1): - LRU_Rand_NoExpire: 219.6ns →...
PR should hopefully address #17 ### Changes * Adds `ContainsOrAdd(key, value) (contains, evicted)` in an attempt to match [hashicorps ContainsOrAdd function](https://github.com/hashicorp/golang-lru/blob/main/lru.go) * Adds similar function `ContainsOrSet(key, value, ttl) (contains)` to...
Failed here, seems like I misconfigured it and now it's not a warning but failing the pipeline: https://github.com/go-pkgz/expirable-cache/actions/runs/17701788475