MCPcopy Create free account
hub / github.com/ClashDotNetFramework/experimental-clash / TestCache_Basic

Function TestCache_Basic

common/cache/cache_test.go:11–23  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestCache_Basic(t *testing.T) {
12 interval := 200 * time.Millisecond
13 ttl := 20 * time.Millisecond
14 c := New(interval)
15 c.Put("int", 1, ttl)
16 c.Put("string", "a", ttl)
17
18 i := c.Get("int")
19 assert.Equal(t, i.(int), 1, "should recv 1")
20
21 s := c.Get("string")
22 assert.Equal(t, s.(string), "a", "should recv 'a'")
23}
24
25func TestCache_TTL(t *testing.T) {
26 interval := 200 * time.Millisecond

Callers

nothing calls this directly

Calls 3

NewFunction · 0.70
PutMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected