Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection config cache data not available if read back immediately #90

Closed
kaidaguerre opened this issue Apr 8, 2021 · 0 comments
Closed

Comments

@kaidaguerre
Copy link
Contributor

as per the ristretto cache documentation: https://github.com/dgraph-io/ristretto/blob/master/README.md, a short (10ms) delay is required after a cache set to ensure the data passes through the buffers

Usage
Example
func main() {
	cache, err := ristretto.NewCache(&ristretto.Config{
		NumCounters: 1e7,     // number of keys to track frequency of (10M).
		MaxCost:     1 << 30, // maximum cost of cache (1GB).
		BufferItems: 64,      // number of keys per Get buffer.
	})
	if err != nil {
		panic(err)
	}

	// set a value with a cost of 1
	cache.Set("key", "value", 1)
	
	// wait for value to pass through buffers
	time.Sleep(10 * time.Millisecond)

	value, found := cache.Get("key")
	if !found {
		panic("missing value")
	}
	fmt.Println(value)
	cache.Del("key")
}
@kaidaguerre kaidaguerre changed the title Connection config cache results are not available if read back immediately Connection config cache data not available if read back immediately Apr 8, 2021
kaidaguerre added a commit that referenced this issue Apr 8, 2021
… results are available if read back immediately. Closes #90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant