MCPcopy Index your code
hub / github.com/go-dev-frame/sponge / NewMemoryCache

Function NewMemoryCache

pkg/cache/memory.go:122–129  ·  view source on GitHub ↗

NewMemoryCache create a memory cache

(keyPrefix string, encode encoding.Encoding, newObject func() interface{})

Source from the content-addressed store, hash-verified

120
121// NewMemoryCache create a memory cache
122func NewMemoryCache(keyPrefix string, encode encoding.Encoding, newObject func() interface{}) Cache {
123 return &memoryCache{
124 client: GetGlobalMemoryCli(),
125 KeyPrefix: keyPrefix,
126 encoding: encode,
127 newObject: newObject,
128 }
129}
130
131// Set data
132func (m *memoryCache) Set(_ context.Context, key string, val interface{}, expiration time.Duration) error {

Callers 3

NewCacheNameExampleCacheFunction · 0.92
NewUserExampleCacheFunction · 0.92
newMemoryCacheFunction · 0.85

Calls 1

GetGlobalMemoryCliFunction · 0.85

Tested by 1

newMemoryCacheFunction · 0.68