chore: add expire duration

This commit is contained in:
nathan 2024-02-24 15:47:28 +08:00
parent 10fc8dd2fe
commit 8e9031c669
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ impl SnapshotCache {
pub async fn insert(&self, key: &str, value: Vec<u8>) -> Result<(), AppError> { pub async fn insert(&self, key: &str, value: Vec<u8>) -> Result<(), AppError> {
let mut redis = self.redis_client.lock().await; let mut redis = self.redis_client.lock().await;
redis redis
.set(key, value) .set_ex(key, value, 60 * 60 * 24)
.await .await
.map_err(|err| AppError::Internal(err.into()))?; .map_err(|err| AppError::Internal(err.into()))?;
Ok(()) Ok(())