blob: a04e2baf8afe5c5cb6c06af57552bac871366aff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package cachedtvm
import (
"time"
"github.com/karlseguin/ccache/v2"
)
type cache struct {
*ccache.Cache
ttl time.Duration
}
func (c *cache) Fetch(key string, fn func() (interface{}, error)) (*ccache.Item, error) {
return c.Cache.Fetch(key, c.ttl, fn)
}
func (c *cache) Stop() {
if c.Cache != nil {
c.Cache.Stop()
}
}
|