al8n / stretto

Stretto is a Rust implementation for Dgraph's ristretto (https://github.com/dgraph-io/ristretto). A high performance memory-bound Rust cache.
Apache License 2.0
413 stars 28 forks source link

feat: add non-panicking alternatives for cache methods that mutably borrow buckets #11

Closed sebasmagri closed 2 years ago

sebasmagri commented 2 years ago

As the .borrow_mut() method on the RwLock used for the expiration map buckets can panic when called and already borrowed, this change adds non-panicking alternatives to the caches' update and insert* methods prefixed by try_ to make it possible for library users to handle the error.

Related to #10