Skip to content

Releases: jellydator/ttlcache

2.8.1 - Performance improvement

17 Sep 17:26
Compare
Choose a tag to compare

#53 Avoids recalculation of TTL value returned in API when TTL is extended.

2.8.0 - Add GetWithTTL

19 Aug 12:49
Compare
Choose a tag to compare

API Change

  • The call GetWithTTL(key string) (interface{}, time.Duration, error) is added so that you can retrieve an item, and also know the remaining TTL. Thanks to @asgarciap for contributing.

"got panic"

03 Jun 20:03
Compare
Choose a tag to compare

#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.

Improved concurrency in loader function.

26 May 19:53
Compare
Choose a tag to compare

#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 result when it is fetched. Thanks go out to @jspri

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).

2.5.0

22 May 18:48
Compare
Choose a tag to compare

API changes:

  • #39 : Allow custom loader function for each key via GetByLoader

Introduce the SimpleCache interface for quick-start and basic usage.

Add manipulation calls

11 Apr 19:17
Compare
Choose a tag to compare

2.4.0 - Add some item manipulation

#42 : Add option to get list of keys
#40: Allow 'Touch' on items without other operation

// Touch resets the TTL of the key when it exists, returns ErrNotFound if the key is not present.
func (cache *Cache) Touch(key string) error 

// GetKeys returns all keys of items in the cache. Returns nil when the cache has been closed.
func (cache *Cache) GetKeys() []string 

2.3.0 - Improved expiry information

04 Feb 08:32
Compare
Choose a tag to compare

2.3.0 (February 2021)

API changes:

  • #38: Added func (cache *Cache) SetExpirationReasonCallback(callback ExpireReasonCallback) This wil function will replace SetExpirationCallback(..) in the next major version.

2.2.0 - Metrics support

19 Jan 09:27
Compare
Choose a tag to compare

2.2.0 (January 2021)

API changes:
#37 : a GetMetrics call is now available for some information on hits/misses etc.

#34 : Errors are now const

Version 2.1.0

13 Oct 21:04
Compare
Choose a tag to compare

2.1.0 (October 2020)

API changes

  • SetCacheSizeLimit(limit int) a call was contributed to set a cache limit. #35

Version 2

28 Jul 19:53
Compare
Choose a tag to compare

2.0.0 (July 2020)

Fixes #29, #30, #31

Behavioural changes

  • Remove(key) now also calls the expiration callback when it's set
  • Count() returns zero when the cache is closed

API changes

  • SetLoaderFunction allows you to provide a function to retrieve data on missing cache keys.
  • Operations that affect item behaviour such as Close, Set, SetWithTTL, Get, Remove, Purge now return an error with standard errors ErrClosed an ErrNotFound instead of a bool or nothing
  • SkipTTLExtensionOnHit replaces SkipTtlExtensionOnHit to satisfy golint
  • The callback types are now exported