mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2026-01-04 23:43:16 -06:00
use ttlcache
This commit is contained in:
parent
73fc5cf2f0
commit
cf1dcdf46a
7 changed files with 15 additions and 66 deletions
9
internal/cache/fetch.go
vendored
9
internal/cache/fetch.go
vendored
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue