MCPcopy Create free account
hub / github.com/Creatly/creatly-backend / setTtlTimer

Method setTtlTimer

pkg/cache/memory.go:30–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28}
29
30func (c *MemoryCache) setTtlTimer() {
31 for {
32 c.Lock()
33 for k, v := range c.cache {
34 if time.Now().Unix()-v.createdAt > v.ttl {
35 delete(c.cache, k)
36 }
37 }
38 c.Unlock()
39
40 <-time.After(time.Second)
41 }
42}
43
44func (c *MemoryCache) Set(key, value interface{}, ttl int64) error {
45 c.Lock()

Callers 1

NewMemoryCacheFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected