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

Function TestRuntimeCache_Incr

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

Source from the content-addressed store, hash-verified

131}
132
133func TestRuntimeCache_Incr(t *testing.T) {
134 cache := NewRuntimeCache()
135 var wg sync.WaitGroup
136 wg.Add(2)
137
138 go func(cache *RuntimeCache) {
139 for i := 0; i < 50; i++ {
140 cache.Incr(TESTCacheKey)
141 }
142
143 wg.Add(-1)
144 }(cache)
145
146 go func(cache *RuntimeCache) {
147 for i := 0; i < 50; i++ {
148 cache.Incr(TESTCacheKey)
149 }
150 wg.Add(-1)
151 }(cache)
152
153 wg.Wait()
154
155 value, e := cache.GetInt(TESTCacheKey)
156 test.Nil(t, e)
157
158 test.Equal(t, 100, value)
159}
160
161func TestRuntimeCache_Decr(t *testing.T) {
162 cache := NewRuntimeCache()

Callers

nothing calls this directly

Calls 5

IncrMethod · 0.95
GetIntMethod · 0.95
NilFunction · 0.92
EqualFunction · 0.92
NewRuntimeCacheFunction · 0.70

Tested by

no test coverage detected