Releases: parMaster/mcache
Releases · parMaster/mcache
Release list
v2.0.0
Breaking Changes
WithCleanupnow takes acontext.Contextas its first argument:WithCleanup[T](ctx, interval)instead ofWithCleanup[T](interval). The background goroutine stops whenctxis cancelled.Hasnow returns a singleerrorinstead of(bool, error). Checkerr == nilinstead of the old boolean return value.Clearno longer returns anerror(it never actually failed).Cleanupis no longer part of theCacherinterface. It's still available on the concrete*Cache[T]returned byNewCache, or useWithCleanupfor automatic background cleanup.
New
Update(key, value, ttl) bool— sets a key unconditionally, overwriting any existing value or expiration, even if the key is still live. UnlikeSet, which refuses to overwrite a live key,Updatealways succeeds unlessttlis negative.Len() int— returns the current number of keys in the cache, including expired keys that haven't been cleaned up yet.
Other
- Test coverage restored to 100% of statements, including the previously race-only branches in
GetandHas's write-lock recheck path. - Module path is now
github.com/parMaster/mcache/v2. Update your import:import "github.com/parMaster/mcache/v2"
- Go bumped to 1.25.1;
testifyupdated to v1.11.1.
See the README for full migration details and the updated API reference.