Skip to content

Commit

Permalink
bumps up
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Jun 10, 2022
1 parent 05bf1bc commit 00ba69d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stretto"
version = "0.4.4"
version = "0.4.6"
authors = ["Al Liu <[email protected]>"]
description = "Stretto is a high performance thread-safe memory-bound Rust cache."
homepage = "https://github.com/al8n/stretto"
Expand Down Expand Up @@ -47,14 +47,14 @@ parking_lot = "0.12"
rand = "0.8"
serde = {version = "1", optional = true}
serde_json = {version = "1", optional = true}
tokio = { version = "1.17", optional = true }
tokio = { version = "1.19", optional = true }
twox-hash = "1.6"
wg = "0.2"

[dev-dependencies]
serde = {version = "1", features = ["serde_derive"]}
serde_json = "1"
tokio = {version = "1.17", features = ["rt-multi-thread", "test-util"]}
tokio = {version = "1.19", features = ["rt-multi-thread", "test-util"]}

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion src/cache/axync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ impl<K, V, KH, C, U, CB, S> AsyncCache<K, V, KH, C, U, CB, S>
C: Coster<V>,
U: UpdateValidator<V>,
CB: CacheCallback<V>,
S: BuildHasher + Clone + 'static,
S: BuildHasher + Clone + 'static + Send,
{
/// `insert` attempts to add the key-value item to the cache. If it returns false,
/// then the `insert` was dropped and the key-value item isn't added to the cache. If
Expand Down
11 changes: 5 additions & 6 deletions src/cache/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,15 +696,14 @@ mod sync_test {
fn test_valueref_ttl() {
let ttl = Duration::from_secs(1);
let c = Cache::builder(100, 1000)
.set_key_builder(TransparentKeyBuilder::default())
.set_metrics(true)
.finalize()
.unwrap();
.set_key_builder(TransparentKeyBuilder::default())
.set_metrics(true)
.finalize()
.unwrap();
c.try_insert_with_ttl(1, 1, 1, ttl).unwrap();
c.wait().unwrap();
let val = c.get(&1).unwrap();
assert!(val.ttl()>Duration::from_millis(900));

assert!(val.ttl() > Duration::from_millis(900));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const DEFAULT_SAMPLES: usize = 5;

macro_rules! impl_policy {
($policy: ident) => {
use crate::policy::DEFAULT_SAMPLES;
use crate::policy::PolicyPair;
use crate::policy::DEFAULT_SAMPLES;

impl $policy {
#[inline]
Expand Down
8 changes: 4 additions & 4 deletions src/policy/axync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(crate) struct AsyncLFUPolicy<S = RandomState> {
pub(crate) metrics: Arc<Metrics>,
}

impl<S: BuildHasher + Clone + 'static> AsyncLFUPolicy<S> {
impl<S: BuildHasher + Clone + 'static + Send> AsyncLFUPolicy<S> {
#[inline]
pub fn with_hasher(ctrs: usize, max_cost: i64, hasher: S) -> Result<Self, CacheError> {
let inner = PolicyInner::with_hasher(ctrs, max_cost, hasher)?;
Expand Down Expand Up @@ -84,7 +84,7 @@ pub(crate) struct PolicyProcessor<S: BuildHasher + Clone + 'static> {
stop_rx: Receiver<()>,
}

impl<S: BuildHasher + Clone + 'static> PolicyProcessor<S> {
impl<S: BuildHasher + Clone + 'static + Send> PolicyProcessor<S> {
#[inline]
fn new(
inner: Arc<Mutex<PolicyInner<S>>>,
Expand Down Expand Up @@ -130,8 +130,8 @@ impl<S: BuildHasher + Clone + 'static> PolicyProcessor<S> {

}

unsafe impl<S: BuildHasher + Clone + 'static> Send for PolicyProcessor<S> {}
unsafe impl<S: BuildHasher + Clone + 'static> Sync for PolicyProcessor<S> {}
unsafe impl<S: BuildHasher + Clone + 'static + Send> Send for PolicyProcessor<S> {}
unsafe impl<S: BuildHasher + Clone + 'static + Send + Sync> Sync for PolicyProcessor<S> {}


impl_policy!(AsyncLFUPolicy);

0 comments on commit 00ba69d

Please sign in to comment.