MCPcopy Create free account
hub / github.com/devfeel/dotweb / TestRuntimeCache_ClearAll

Function TestRuntimeCache_ClearAll

cache/runtime/cache_runtime_test.go:111–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestRuntimeCache_ClearAll(t *testing.T) {
112 cache := NewRuntimeCache()
113 cache.Set(TESTCacheKey, TESTCacheValue, 2)
114 cache.Set("2", TESTCacheValue, 2)
115 cache.Set("3", TESTCacheValue, 2)
116
117 val2, err := cache.GetString("2")
118 if err != nil {
119 t.Error(err)
120 }
121 test.Equal(t, TESTCacheValue, val2)
122
123 cache.ClearAll()
124 exists2, err := cache.Exists("2")
125 if err != nil {
126 t.Error(err)
127 }
128 if exists2 {
129 t.Error("exists 2 but need not exists")
130 }
131}
132
133func TestRuntimeCache_Incr(t *testing.T) {
134 cache := NewRuntimeCache()

Callers

nothing calls this directly

Calls 7

SetMethod · 0.95
GetStringMethod · 0.95
ClearAllMethod · 0.95
ExistsMethod · 0.95
EqualFunction · 0.92
NewRuntimeCacheFunction · 0.70
ErrorMethod · 0.65

Tested by

no test coverage detected