Comments (3)
Because keys are stored inside a
KeyRef
type,.get()
can be complicated or inefficient. For instance, if I have a cache which stores the key as aVec<u8>
, I'd expect to be able to lookup a value a in the cache using a&[u8]
, but that's not possible:error[E0277]: the trait bound `KeyRef<Vec<u8>>: Borrow<[u8]>` is not satisfied --> native/lib.rs:98:17 | 98 | match cache.get(key.as_slice()) { | ^^^ the trait `Borrow<[u8]>` is not implemented for `KeyRef<Vec<u8>>` | = help: the following implementations were found: <KeyRef<K> as Borrow<K>>
Thanks for pointing it out! KeyRef
is used to break the Rust language limitation to avoid using Rc
, I am not aware that this will bring inefficient to something key like Vec<T>
situation. I will try to fix it in the next 2 or 3 weeks, if you have any good ideas, welcome PR. If you cannot wait and do not care about the no_std
and the background cache algorithms, there are two modern high-performance cache crates that guarantee concurrent-safe, stretto and moka.
from caches-rs.
This is needed for rustls. @al8n would you like to take a look on how to solve it again?
from caches-rs.
Sorry for the late fixes. It was fixed by the new release 0.2.6
.
from caches-rs.
Related Issues (10)
- WTinyLFUCache panics with misaligned pointer dereference in debug builds HOT 4
- Many methods return lifetimes that are not tied to the lifetime of self HOT 2
- Random failures may caused by the probabilistic data structure `Bloom`
- Fix `miri test`
- no_std compatability HOT 6
- bare metal support HOT 3
- Support for LHD implementation
- How do you choose a sample size for the cache ? HOT 3
- Buggy behavior on ARC HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caches-rs.