Skip to content

Commit

Permalink
Moka v0.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolence committed Sep 18, 2023
1 parent 556130b commit 19cda79
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async-trait = "0.1"
hex = "0.4"
backoff = { version = "0.4", features = ["tokio"] }
redb = { version = "1.1", optional = true }
moka = { version = "0.11", features = ["future"], optional = true } # Caching library
moka = { version = "0.12", features = ["future"], optional = true } # Caching library

[dev-dependencies]
cargo-husky = { version = "1.5", default-features = false, features = ["run-for-all", "prepush-hook", "run-cargo-fmt"] }
Expand Down
6 changes: 3 additions & 3 deletions src/cache/backends/memory_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::*;
use async_trait::async_trait;
use chrono::Utc;
use futures::stream::BoxStream;
use moka::future::{Cache, CacheBuilder, ConcurrentCacheExt};
use moka::future::{Cache, CacheBuilder};

use futures::TryStreamExt;
use std::collections::HashMap;
Expand Down Expand Up @@ -78,7 +78,7 @@ impl FirestoreMemoryCacheBackend {
})
.await?;

mem_cache.sync();
mem_cache.run_pending_tasks().await;

info!(
"Preloading collection `{}` has been finished. Loaded: {} entries",
Expand Down Expand Up @@ -183,7 +183,7 @@ impl FirestoreCacheDocsByPathSupport for FirestoreMemoryCacheBackend {
document_path: &str,
) -> FirestoreResult<Option<FirestoreDocument>> {
match self.collection_caches.get(collection_id) {
Some(mem_cache) => Ok(mem_cache.get(document_path)),
Some(mem_cache) => Ok(mem_cache.get(document_path).await),
None => Ok(None),
}
}
Expand Down

0 comments on commit 19cda79

Please sign in to comment.