MCPcopy
hub / github.com/usememos/memos / New

Function New

store/cache/cache.go:76–85  ·  view source on GitHub ↗

New creates a new memory cache with the given configuration.

(config Config)

Source from the content-addressed store, hash-verified

74
75// New creates a new memory cache with the given configuration.
76func New(config Config) *Cache {
77 c := &Cache{
78 config: config,
79 stopChan: make(chan struct{}),
80 closedChan: make(chan struct{}),
81 }
82
83 go c.cleanupLoop()
84 return c
85}
86
87// NewDefault creates a new memory cache with default configuration.
88func NewDefault() *Cache {

Callers 5

NewFunction · 0.92
NewDefaultFunction · 0.70
TestCacheBasicOperationsFunction · 0.70
TestCacheEvictionFunction · 0.70
TestEvictionCallbackFunction · 0.70

Calls 1

cleanupLoopMethod · 0.95

Tested by 3

TestCacheBasicOperationsFunction · 0.56
TestCacheEvictionFunction · 0.56
TestEvictionCallbackFunction · 0.56