aboutsummaryrefslogtreecommitdiffhomepage
path: root/pingora-memory-cache
diff options
context:
space:
mode:
authorYuchen Wu <[email protected]>2024-03-08 02:02:23 -0800
committerYuchen Wu <[email protected]>2024-03-22 14:26:16 -0700
commitab86012c66f61c1d1e3b6251d8c59504abe1c529 (patch)
tree11c71677549422c4ff99c726da125fedd0907bad /pingora-memory-cache
parentb9d4428809385b8d72d74176e92941a0eddb4829 (diff)
downloadpingora-ab86012c66f61c1d1e3b6251d8c59504abe1c529.tar.gz
pingora-ab86012c66f61c1d1e3b6251d8c59504abe1c529.zip
TinyUFO: add the option to use sharded skip list for storage
This option makes it more memory efficient but a bit slower.
Diffstat (limited to 'pingora-memory-cache')
-rw-r--r--pingora-memory-cache/src/lib.rs2
-rw-r--r--pingora-memory-cache/src/read_through.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/pingora-memory-cache/src/lib.rs b/pingora-memory-cache/src/lib.rs
index f5c037c..2b02d28 100644
--- a/pingora-memory-cache/src/lib.rs
+++ b/pingora-memory-cache/src/lib.rs
@@ -81,7 +81,7 @@ pub struct MemoryCache<K: Hash, T: Clone> {
pub(crate) hasher: RandomState,
}
-impl<K: Hash, T: Clone + Send + Sync> MemoryCache<K, T> {
+impl<K: Hash, T: Clone + Send + Sync + 'static> MemoryCache<K, T> {
/// Create a new [MemoryCache] with the given size.
pub fn new(size: usize) -> Self {
MemoryCache {
diff --git a/pingora-memory-cache/src/read_through.rs b/pingora-memory-cache/src/read_through.rs
index 05a8d89..a10a7c0 100644
--- a/pingora-memory-cache/src/read_through.rs
+++ b/pingora-memory-cache/src/read_through.rs
@@ -123,7 +123,7 @@ where
impl<K, T, CB, S> RTCache<K, T, CB, S>
where
K: Hash + Send,
- T: Clone + Send + Sync,
+ T: Clone + Send + Sync + 'static,
{
/// Create a new [RTCache] of given size. `lock_age` defines how long a lock is valid for.
/// `lock_timeout` is used to stop a lookup from holding on to the key for too long.
@@ -142,7 +142,7 @@ where
impl<K, T, CB, S> RTCache<K, T, CB, S>
where
K: Hash + Send,
- T: Clone + Send + Sync,
+ T: Clone + Send + Sync + 'static,
CB: Lookup<K, T, S>,
{
/// Query the cache for a given value. If it exists and no TTL is configured initially, it will
@@ -288,7 +288,7 @@ where
impl<K, T, CB, S> RTCache<K, T, CB, S>
where
K: Hash + Send,
- T: Clone + Send + Sync,
+ T: Clone + Send + Sync + 'static,
CB: MultiLookup<K, T, S>,
{
/// Same behavior as [RTCache::get] but for an arbitrary amount of keys.