Add GetWithoutPromote

This gets the value without promoting it (sort of like a Peak)
This commit is contained in:
Karl Seguin
2022-01-24 12:51:35 +08:00
parent ef4bd54683
commit 451f5a6e42
5 changed files with 45 additions and 0 deletions

View File

@@ -116,6 +116,13 @@ func (c *Cache) Get(key string) *Item {
return item
}
// Same as Get but does not promote the value. This essentially circumvents the
// "least recently used" aspect of this cache. To some degree, it's akin to a
// "peak"
func (c *Cache) GetWithoutPromote(key string) *Item {
return c.bucket(key).get(key)
}
// Used when the cache was created with the Track() configuration option.
// Avoid otherwise
func (c *Cache) TrackingGet(key string) TrackedItem {