ttlcache v2.7.0 Release NotesRelease Date: 2021-06-01 // 5 months ago
46 : got panic
A panic occured in a line that checks the maximum amount of items in the cache. While not definite root cause has been found, there is indeed the possibility of crashing an empty cache if the cache limit is set to 'zero' which codes for infinite. This would lead to removal of the first item in the cache which would panic on an empty cache.
🛠 Fixed this by applying the global cache lock to all configuration options as well.
Previous changes from v2.6.0
🔀 #44 : There are no API changes, but a contribution was made to use https://pkg.go.dev/golang.org/x/sync/singleflight as a way to provide everybody waiting for a key with that key when it's fetched.
🚚 This removes some complexity from the code and will make sure that all callers will get a return value even if there's high concurrency and low TTL (as proven by the test that was added).