Skip to content

Releases: jellydator/ttlcache

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

Remove vendoring, and change Close behaviour

22 Jul 06:21
Compare
Choose a tag to compare

This release has two points:

  • Remove vendoring and continue with modules only. I consider this not breaking as this is a possibility since Go 1.11 and is not an issue on the current Go 1.13 and 1.14 build.
  • Fixed issue #28: call expirationCallback automatically on cache.Close()

Note that while all expirationCallback routines are called for all items in the cache on cache.Close() there is no synchronized wait. This is the current behavior for expiration at runtime. It's up to the cache creator to decide whether to built in synchronization for a full clean shutdown. See TestCache_ExpirationOnClose(t *testing.T) for a sample with synchronization.

Add a Close method to clean up resources

15 Oct 11:31
Compare
Choose a tag to compare

In issue #23 it became clear that people want to create and drop caches on the fly. There was a goroutine leak in that case.

  • The goroutine leak is fixed, after calling Close, an empty cache remains.
  • Tests are now done with uber goroutine leak detector.
  • Test logging has been cleaned.
  • 100% coverage, not by synthetic testing but by building up the test suite with seen issues over time.

Same release as 1.5.0 but proper go module tag.

20 Aug 15:18
823b876
Compare
Choose a tag to compare

Fix crash, fix timer allocation

17 Jun 12:41
823b876
Compare
Choose a tag to compare

Depending on your usage, the issues fixed may improve stability of your programs:

#20 : A crash was observed by me in a configuration that was not in the test suite. This subsequently triggered some rework on the locking.

Fix data race, fix memory usage

29 Apr 08:22
86f5295
Compare
Choose a tag to compare

Depending on your usage, the issues fixed may improve stability of your programs:

#17 : Fixes a data race on read and introduces RWLock which is better for performance on heavy workloads.
#18 : Addresses excessive memory usage if you have a long running timer as global TTL. if pprof shows most of your memory in use coming from ttlcache then you must upgrade:

[...]
----------------------------------------------------------+-------------
      flat  flat%   sum%        cum   cum%   calls calls% + context 	 	 
----------------------------------------------------------+-------------
                                         1034.31MB   100% |   github.com/ReneKroon/ttlcache.(*Cache).startExpirationProcessing
  983.58MB 82.74% 82.74%  1034.31MB 87.00%                | time.NewTimer
                                           50.73MB  4.90% |   time.startTimer
----------------------------------------------------------+-------------

Bug Fix

27 Mar 19:37
dcd0e0a
Compare
Choose a tag to compare

Fixes issue #15 - checkExpireCallback doesn't work when skipTtlExtension is enabled.

Add setting to skip automatic TTL extension

08 Sep 20:52
Compare
Choose a tag to compare

This fixes issue #12 and updates the Travis CI to current go versions.

SkipTtlExtensionOnHit allows the user to change the cache behaviour. When this flag is set to true it will
no longer extend TTL of items when they are retrieved using Get, or when their expiration condition is evaluated using SetCheckExpirationCallback.

Fix bug when using SetCheckExpirationCallback

08 Sep 20:21
Compare
Choose a tag to compare

This fixes issue #14, which can occur when using SetCheckExpirationCallback and it returns false on the last element in the list.