Failed to write to cache with TTL

I am using ristretto cache as shown in the official example, but the get operation failed frequently. I think my example entry was not not successfully written to cache (instead of being evicted). Is there any specific settings to make sure “writing to cache” always succeed?

I am trying out the following code:

	cache, _ := ristretto.NewCache(&ristretto.Config{
		NumCounters: 1e6,     // Num keys to track frequency of (1M).
		MaxCost:     1 << 26, // Maximum cost of cache (64MB).
		BufferItems: 64,      // Number of keys per Get buffer.
	})
	cache.SetWithTTL("key", "value", 1, 600*time.Second) // set a value
	// wait for value to pass through buffers
	time.Sleep(10 * time.Millisecond)

	value, found := cache.Get("key") <<< FAILURE 

ok, seems I need to increase the delay to ensure the values are passed through buffers