use ttlcache

This commit is contained in:
tsmethurst 2021-08-19 16:16:16 +02:00
commit cf1dcdf46a
7 changed files with 15 additions and 66 deletions

View file

@ -19,15 +19,10 @@
package cache
func (c *cache) Fetch(k string) (interface{}, error) {
ceI, stored := c.stored.Load(k)
i, stored := c.c.Get(k)
if !stored {
return nil, ErrNotFound
}
ce, ok := ceI.(*cacheEntry)
if !ok {
panic("cache entry was not a *cacheEntry -- this should never happen")
}
return ce.value, nil
return i, nil
}