You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose adding the ability to have a per-key TTL to the Expirable implementation. This would accept a time.Duration and set the ExpiresAt of the LRU entry to the passed duration. Passing a value <= 0 would result in turning expiring off, as is the case when setting the TTL for a new Expirable cache.
// AddWithTtl creates an entry with the provided TTL, overriding the cache-level TTL
func (c *LRU[K, V]) AddWithTtl(key K, value V, t time.Duration) (evicted bool)
The existing Add method would remain unchanged and would use the cache's TTL value.
I'm opening this issue to start a discussion about this design and will open a PR after discussion- tagging @mgaffney@jefferai@paskal for feedback.
The text was updated successfully, but these errors were encountered:
I'd like to propose adding the ability to have a per-key TTL to the Expirable implementation. This would accept a
time.Duration
and set theExpiresAt
of the LRU entry to the passed duration. Passing a value <= 0 would result in turning expiring off, as is the case when setting the TTL for a new Expirable cache.The existing
Add
method would remain unchanged and would use the cache's TTL value.I'm opening this issue to start a discussion about this design and will open a PR after discussion- tagging @mgaffney @jefferai @paskal for feedback.
The text was updated successfully, but these errors were encountered: