MCPcopy
hub / github.com/nextlevelbuilder/goclaw / TestInMemoryCache_GetSet

Function TestInMemoryCache_GetSet

internal/cache/memory_test.go:9–21  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestInMemoryCache_GetSet(t *testing.T) {
10 c := NewInMemoryCache[string]()
11 ctx := context.Background()
12
13 c.Set(ctx, "hello", "world", 0)
14 val, ok := c.Get(ctx, "hello")
15 if !ok {
16 t.Fatal("expected key to exist")
17 }
18 if val != "world" {
19 t.Fatalf("expected 'world', got %q", val)
20 }
21}
22
23func TestInMemoryCache_TTLExpiry(t *testing.T) {
24 c := NewInMemoryCache[int]()

Callers

nothing calls this directly

Calls 2

SetMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected