mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 12:19:37 -06:00
build(deps): bump github.com/jellydator/ttlcache/v3 from 3.1.1 to 3.2.0
Bumps [github.com/jellydator/ttlcache/v3](https://github.com/jellydator/ttlcache) from 3.1.1 to 3.2.0. - [Release notes](https://github.com/jellydator/ttlcache/releases) - [Commits](https://github.com/jellydator/ttlcache/compare/v3.1.1...v3.2.0) --- updated-dependencies: - dependency-name: github.com/jellydator/ttlcache/v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
4
vendor/github.com/jellydator/ttlcache/v3/cache.go
generated
vendored
4
vendor/github.com/jellydator/ttlcache/v3/cache.go
generated
vendored
@@ -148,6 +148,10 @@ func (c *Cache[K, V]) set(key K, value V, ttl time.Duration) *Item[K, V] {
|
||||
c.evict(EvictionReasonCapacityReached, c.items.lru.Back())
|
||||
}
|
||||
|
||||
if ttl == PreviousOrDefaultTTL {
|
||||
ttl = c.options.ttl
|
||||
}
|
||||
|
||||
// create a new item
|
||||
item := newItem(key, value, ttl, c.options.enableVersionTracking)
|
||||
elem = c.items.lru.PushFront(item)
|
||||
|
||||
20
vendor/github.com/jellydator/ttlcache/v3/item.go
generated
vendored
20
vendor/github.com/jellydator/ttlcache/v3/item.go
generated
vendored
@@ -9,6 +9,10 @@ const (
|
||||
// NoTTL indicates that an item should never expire.
|
||||
NoTTL time.Duration = -1
|
||||
|
||||
// PreviousOrDefaultTTL indicates that existing TTL of item should be used
|
||||
// default TTL will be used as fallback if item doesn't exist
|
||||
PreviousOrDefaultTTL time.Duration = -2
|
||||
|
||||
// DefaultTTL indicates that the default TTL value of the cache
|
||||
// instance should be used.
|
||||
DefaultTTL time.Duration = 0
|
||||
@@ -58,17 +62,23 @@ func (item *Item[K, V]) update(value V, ttl time.Duration) {
|
||||
defer item.mu.Unlock()
|
||||
|
||||
item.value = value
|
||||
|
||||
// update version if enabled
|
||||
if item.version > -1 {
|
||||
item.version++
|
||||
}
|
||||
|
||||
// no need to update ttl or expiry in this case
|
||||
if ttl == PreviousOrDefaultTTL {
|
||||
return
|
||||
}
|
||||
|
||||
item.ttl = ttl
|
||||
|
||||
// reset expiration timestamp because the new TTL may be
|
||||
// 0 or below
|
||||
item.expiresAt = time.Time{}
|
||||
item.touchUnsafe()
|
||||
|
||||
// update version if enabled
|
||||
if item.version > -1 {
|
||||
item.version++
|
||||
}
|
||||
}
|
||||
|
||||
// touch updates the item's expiration timestamp.
|
||||
|
||||
Reference in New Issue
Block a user