MCPcopy
hub / github.com/grafana/dskit / TestMemcachedClient_FlushAll

Function TestMemcachedClient_FlushAll

cache/memcached_client_test.go:300–321  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

298}
299
300func TestMemcachedClient_FlushAll(t *testing.T) {
301 client, _, err := setupDefaultMemcachedClient()
302 require.NoError(t, err)
303
304 keys := []string{"foo", "bar"}
305 expiration := 10 * time.Second
306
307 client.SetMultiAsync(map[string][]byte{"foo": []byte("bar"), "bar": []byte("baz")}, expiration)
308 require.NoError(t, client.wait())
309
310 // Verify that the data is initially present
311 tmpRes := client.GetMulti(context.Background(), keys)
312 require.NotEmpty(t, tmpRes)
313
314 // FlushAll operation
315 err = client.FlushAll(context.Background())
316 require.NoError(t, err)
317
318 // Verify that the cash is empty after FlushAll
319 res := client.GetMulti(context.Background(), keys)
320 require.Empty(t, res)
321}
322
323func TestMemcachedClient_Delete(t *testing.T) {
324 client, _, err := setupDefaultMemcachedClient()

Callers

nothing calls this directly

Calls 5

waitMethod · 0.80
SetMultiAsyncMethod · 0.65
GetMultiMethod · 0.65
FlushAllMethod · 0.65

Tested by

no test coverage detected