(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func 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 | |
| 23 | func TestInMemoryCache_TTLExpiry(t *testing.T) { |
| 24 | c := NewInMemoryCache[int]() |