MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / NewCacheWithClient

Function NewCacheWithClient

internal/cache/cache.go:83–89  ·  view source on GitHub ↗

NewCacheWithClient creates a new RedisCache using an existing Redis client. No error is returned because no I/O occurs — the client is already validated.

(client redis.UniversalClient)

Source from the content-addressed store, hash-verified

81// NewCacheWithClient creates a new RedisCache using an existing Redis client.
82// No error is returned because no I/O occurs — the client is already validated.
83func NewCacheWithClient(client redis.UniversalClient) Cache {
84 c := cache.New(&cache.Options{
85 Redis: client,
86 LocalCache: cache.NewTinyLFU(cacheSize, 1*time.Minute),
87 })
88 return &RedisCache{cache: c}
89}
90
91// cacheSize defines the size of the local cache (in number of entries) used alongside Redis.
92const cacheSize = 128000

Callers 2

newTestDataSourceFunction · 0.92
NewLedgerForgeFunction · 0.92

Calls

no outgoing calls

Tested by 1

newTestDataSourceFunction · 0.74