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

Interface Interface

store/cache/cache.go:11–32  ·  view source on GitHub ↗

Interface defines the operations a cache must support.

Source from the content-addressed store, hash-verified

9
10// Interface defines the operations a cache must support.
11type Interface interface {
12 // Set adds a value to the cache with the default TTL.
13 Set(ctx context.Context, key string, value any)
14
15 // SetWithTTL adds a value to the cache with a custom TTL.
16 SetWithTTL(ctx context.Context, key string, value any, ttl time.Duration)
17
18 // Get retrieves a value from the cache.
19 Get(ctx context.Context, key string) (any, bool)
20
21 // Delete removes a value from the cache.
22 Delete(ctx context.Context, key string)
23
24 // Clear removes all values from the cache.
25 Clear(ctx context.Context)
26
27 // Size returns the number of items in the cache.
28 Size() int64
29
30 // Close stops all background tasks and releases resources.
31 Close() error
32}
33
34// item represents a cached value with metadata.
35type item struct {

Callers 38

UpsertUserSettingMethod · 0.65
ListUserSettingsMethod · 0.65
GetUserSettingMethod · 0.65
UpsertInstanceSettingMethod · 0.65
ListInstanceSettingsMethod · 0.65
TestCacheBasicOperationsFunction · 0.65
GetUserSettingMethod · 0.65
GetInstanceSettingMethod · 0.65
GetUserMethod · 0.65

Implementers 1

Cachestore/cache/cache.go

Calls

no outgoing calls

Tested by

no test coverage detected