update
This commit is contained in:
parent
95c5592170
commit
9a9e77a3bb
4 changed files with 10 additions and 6 deletions
12
src/cache.rs
12
src/cache.rs
|
@ -32,7 +32,7 @@ impl RouteCache {
|
|||
let lock = self.inner.read().await;
|
||||
if let Some(inner_map) = lock.get(route) {
|
||||
if let Some(cached_value) = inner_map.get(id) {
|
||||
log::trace!("Using cached value for {route} / {id}");
|
||||
log::info!("Using cached value for {route} / {id}");
|
||||
return cached_value.clone().unwrap();
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ impl RouteCache {
|
|||
// If the value was not found, acquire a write lock to insert the computed value.
|
||||
let mut lock = self.inner.write().await;
|
||||
|
||||
log::trace!("Computing value for {route} / {id}");
|
||||
log::info!("Computing value for {route} / {id}");
|
||||
let computed = generator().await;
|
||||
|
||||
lock.entry(route.to_string())
|
||||
|
@ -55,7 +55,7 @@ impl RouteCache {
|
|||
let lock = self.inner.read().await;
|
||||
if let Some(inner_map) = lock.get(route) {
|
||||
if let Some(cached_value) = inner_map.get(id) {
|
||||
log::trace!("Using cached value for {route} / {id}");
|
||||
log::info!("Using cached value for {route} / {id}");
|
||||
return cached_value.clone();
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ impl RouteCache {
|
|||
let lock = self.inner.read().await;
|
||||
if let Some(inner_map) = lock.get(route) {
|
||||
if let Some(cached_value) = inner_map.get(id) {
|
||||
log::trace!("Using cached value for {route} / {id}");
|
||||
log::info!("Using cached value for {route} / {id}");
|
||||
return cached_value.clone();
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ impl RouteCache {
|
|||
// If the value was not found, acquire a write lock to insert the computed value.
|
||||
let mut lock = self.inner.write().await;
|
||||
|
||||
log::trace!("Computing value for {route} / {id}");
|
||||
log::info!("Computing value for {route} / {id}");
|
||||
let computed = generator().await;
|
||||
|
||||
lock.entry(route.to_string())
|
||||
|
@ -95,7 +95,7 @@ impl RouteCache {
|
|||
pub async fn insert(&self, route: &str, id: &str, value: String) {
|
||||
let mut lock = self.inner.write().await;
|
||||
|
||||
log::trace!("Inserting value for {route} / {id}");
|
||||
log::info!("Inserting value for {route} / {id}");
|
||||
|
||||
lock.entry(route.to_string())
|
||||
.or_insert_with(HashMap::new)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue