Skip to content

Commit

Permalink
Merge branch 'feat/cache-for-explorer-endpoints' of ssh://github.com/…
Browse files Browse the repository at this point in the history
…iotaledger/inx-chronicle into feat/cache-for-explorer-endpoints
  • Loading branch information
shufps committed Nov 14, 2023
2 parents f5e6e9b + 72a8925 commit d8fa9e9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/bin/inx-chronicle/api/explorer/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ use crate::api::{
ApiResult,
};

use std::time::{Instant, Duration};
use tokio::sync::{RwLock};
use once_cell::sync::Lazy;
use std::time::{Duration, Instant};
use tokio::sync::RwLock;

pub fn routes() -> Router {
Router::new()
Expand Down Expand Up @@ -378,7 +378,10 @@ async fn richest_addresses_ledger_analytics(
};

// Store the response in the cache
*RICHEST_ADDRESSES_CACHE.write().await = Some(RichestCacheData { last_updated: Instant::now(), data: response.clone() });
*RICHEST_ADDRESSES_CACHE.write().await = Some(RichestCacheData {
last_updated: Instant::now(),
data: response.clone(),
});

Ok(response)
}
Expand Down Expand Up @@ -409,7 +412,10 @@ async fn token_distribution_ledger_analytics(
};

// Store the response in the cache
*TOKEN_DISTRIBUTION_CACHE.write().await = Some(TokenCacheData { last_updated: Instant::now(), data: response.clone() });
*TOKEN_DISTRIBUTION_CACHE.write().await = Some(TokenCacheData {
last_updated: Instant::now(),
data: response.clone(),
});

Ok(response)
}
Expand Down

0 comments on commit d8fa9e9

Please sign in to comment.