Skip to content
This repository has been archived by the owner on Aug 20, 2023. It is now read-only.

Update module github.com/ReneKroon/ttlcache to v3 #33

Merged
merged 3 commits into from
Apr 8, 2022

Conversation

jnewland
Copy link
Owner

@jnewland jnewland commented Apr 8, 2022

This PR contains the following updates:

Package Type Update Change
github.com/ReneKroon/ttlcache require major v1.7.0 -> v3.0.0

Release Notes

ReneKroon/ttlcache

v3.0.0

Compare Source

The version 3 of ttlcache includes many breaking changes, some of which improve the general usability and readability of the code, while others extend the current API with new Go features (mainly type parameters). The most notable of these additions/changes are:

  • The new Item type that is returned by both Get and Set methods.
  • The deletion of the Close() method.
  • The rename of Purge() method to DeleteAll().
  • The rewritten New function that now accepts functional options. It also doesn't start the automatic expired item deletion process: the Start() method needs to be explicitly called for it to be activated.
  • Improved event/callback registration methods.
  • More predictable item deletion when the cache's capacity is reached.
  • The new Loader interface.

All new or updated types and functions can be found on the documentation, README, or v3 issue page.

v2.11.1

Compare Source

The v2 module path has been changed.

v2.11.0

Compare Source

2.11.0 (December 2021)
#​64: @​DoubleDi added a method GetItems to retrieve all items in the cache. This method also triggers all callbacks associated with a normal Get

API changes:

// GetItems returns a copy of all items in the cache. Returns nil when the cache has been closed. 
func (cache *Cache) GetItems() map[string]interface{} {..}

v2.10.0

Compare Source

2.10.0 (December 2021)

#​62 : @​nikhilk1701 found a memory leak where removed items are not directly eligible for garbage collection. There are no API changes.

v2.9.0

Compare Source

2.9.0 (October 2021)

#​55,#​56,#​57 : @​chenyahui was on fire and greatly improved the peformance of the library. He also got rid of the blocking call to expirationNotification, making the code run twice as fast in the benchmarks!

v2.8.1

Compare Source

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

v2.8.0

Compare Source

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.

v2.7.0

Compare Source

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

v2.6.0

Compare Source

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

v2.5.0

Compare Source

API changes:

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

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

v2.4.0

Compare Source

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 

v2.3.0

Compare Source

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.

v2.2.0

Compare Source

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

v2.1.0

Compare Source

2.1.0 (October 2020)

API changes

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

v2.0.0

Compare Source

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

Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by Renovate Bot.

@jnewland
Copy link
Owner Author

jnewland commented Apr 8, 2022

⚠ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: go.sum
Command failed: go get -d -t ./...
go: github.com/ReneKroon/ttlcache/v3@v3.0.0: parsing go.mod:
	module declares its path as: github.com/jellydator/ttlcache/v3
	        but was required as: github.com/ReneKroon/ttlcache/v3

@jnewland jnewland enabled auto-merge April 8, 2022 14:04
@jnewland jnewland disabled auto-merge April 8, 2022 14:04
@jnewland jnewland enabled auto-merge April 8, 2022 14:08
@jnewland jnewland merged commit 028cff4 into main Apr 8, 2022
@jnewland jnewland deleted the renovate/github.com-renekroon-ttlcache-3.x branch April 8, 2022 14:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants