Skip to content

Releases: parMaster/mcache

Release list

v2.0.0

Choose a tag to compare

@parMaster parMaster released this 05 Jul 15:30

Breaking Changes

  • WithCleanup now takes a context.Context as its first argument: WithCleanup[T](ctx, interval) instead of WithCleanup[T](interval). The background goroutine stops when ctx is cancelled.
  • Has now returns a single error instead of (bool, error). Check err == nil instead of the old boolean return value.
  • Clear no longer returns an error (it never actually failed).
  • Cleanup is no longer part of the Cacher interface. It's still available on the concrete *Cache[T] returned by NewCache, or use WithCleanup for 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. Unlike Set, which refuses to overwrite a live key, Update always succeeds unless ttl is 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 Get and Has'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; testify updated to v1.11.1.

See the README for full migration details and the updated API reference.

v1.0.0

Choose a tag to compare

@parMaster parMaster released this 27 Nov 13:26

Releasing stable version