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

Function TestMemcachedClient_Touch

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

Source from the content-addressed store, hash-verified

260}
261
262func TestMemcachedClient_Touch(t *testing.T) {
263 client, backend, err := setupDefaultMemcachedClient()
264 require.NoError(t, err)
265
266 key := "foo"
267 value := []byte("bar")
268 expiration := 10 * time.Second
269
270 client.SetAsync(key, value, expiration)
271 require.NoError(t, client.wait())
272
273 newExpiration := 20 * time.Second
274 err = client.Touch(context.Background(), key, newExpiration)
275 require.NoError(t, err)
276 require.Equal(t, int32(newExpiration.Seconds()), backend.values[key].Expiration)
277}
278
279func TestMemcachedClient_CompareAndSwap(t *testing.T) {
280 client, backend, err := setupDefaultMemcachedClient()

Callers

nothing calls this directly

Calls 5

waitMethod · 0.80
SetAsyncMethod · 0.65
TouchMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected