Add GetPossiblyExpired()
This commit is contained in:
parent
e7a9def80f
commit
249f01f691
11
cache.go
11
cache.go
|
@ -135,6 +135,17 @@ func (c *cache) Get(k string) (interface{}, bool) {
|
||||||
return item.Object, true
|
return item.Object, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cache) GetPossiblyExpired(k string) (interface{}, bool) {
|
||||||
|
c.mu.RLock()
|
||||||
|
// "Inlining" of get and Expired
|
||||||
|
item, found := c.items[k]
|
||||||
|
c.mu.RUnlock()
|
||||||
|
if !found {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
return item.Object, true
|
||||||
|
}
|
||||||
|
|
||||||
func (c *cache) get(k string) (interface{}, bool) {
|
func (c *cache) get(k string) (interface{}, bool) {
|
||||||
item, found := c.items[k]
|
item, found := c.items[k]
|
||||||
if !found {
|
if !found {
|
||||||
|
|
Loading…
Reference in New Issue