github.com/bingoohuang/gg@v0.0.0-20240325092523-45da7dee9335/pkg/ttlcache/CHANGELOG.md (about) 1 # 2.11.0 (December 2021) 2 3 #64: @DoubeDi added a method `GetItems` to retrieve all items in the cache. This method also triggers all callbacks associated with a normal `Get` 4 5 ## API changes: 6 7 // GetItems returns a copy of all items in the cache. Returns nil when the cache has been closed. 8 func (cache *Cache) GetItems() map[string]interface{} { 9 10 # 2.10.0 (December 2021) 11 12 #62 : @nikhilk1701 found a memory leak where removed items are not directly eligible for garbage collection. There are no API changes. 13 14 # 2.9.0 (October 2021) 15 16 #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! 17 18 # 2.8.1 (September 2021) 19 20 #53 : Avoids recalculation of TTL value returned in API when TTL is extended. by @iczc 21 22 # 2.8.0 (August 2021) 23 24 #51 : 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. 25 26 # 2.7.0 (June 2021) 27 28 #46 : got panic 29 30 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. 31 32 Fixed this by applying the global cache lock to all configuration options as well. 33 34 # 2.6.0 (May 2021) 35 36 #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 key when it's fetched. 37 38 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). 39 40 # 2.5.0 (May 2021) 41 42 ## API changes: 43 44 * #39 : Allow custom loader function for each key via `GetByLoader` 45 46 Introduce the `SimpleCache` interface for quick-start and basic usage. 47 48 # 2.4.0 (April 2021) 49 50 ## API changes: 51 52 * #42 : Add option to get list of keys 53 * #40: Allow 'Touch' on items without other operation 54 55 // Touch resets the TTL of the key when it exists, returns ErrNotFound if the key is not present. 56 func (cache *Cache) Touch(key string) error 57 58 // GetKeys returns all keys of items in the cache. Returns nil when the cache has been closed. 59 func (cache *Cache) GetKeys() []string 60 61 # 2.3.0 (February 2021) 62 63 ## API changes: 64 65 * #38: Added func (cache *Cache) SetExpirationReasonCallback(callback ExpireReasonCallback) This wil function will replace SetExpirationCallback(..) in the next major version. 66 67 # 2.2.0 (January 2021) 68 69 ## API changes: 70 71 * #37 : a GetMetrics call is now available for some information on hits/misses etc. 72 * #34 : Errors are now const 73 74 # 2.1.0 (October 2020) 75 76 ## API changes 77 78 * `SetCacheSizeLimit(limit int)` a call was contributed to set a cache limit. #35 79 80 # 2.0.0 (July 2020) 81 82 ## Fixes #29, #30, #31 83 84 ## Behavioural changes 85 86 * `Remove(key)` now also calls the expiration callback when it's set 87 * `Count()` returns zero when the cache is closed 88 89 ## API changes 90 91 * `SetLoaderFunction` allows you to provide a function to retrieve data on missing cache keys. 92 * 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 93 * `SkipTTLExtensionOnHit` replaces `SkipTtlExtensionOnHit` to satisfy golint 94 * The callback types are now exported