cave/store: let hosts expire
This commit is contained in:
parent
232a5adabd
commit
ad8080d9cf
|
@ -13,6 +13,7 @@ use crate::{
|
|||
|
||||
const POST_EXPIRE: usize = 86400;
|
||||
const TAG_EXPIRE: u64 = 30 * 24;
|
||||
const HOST_EXPIRE: usize = 30 * 86400;
|
||||
|
||||
pub const TREND_POOL_SIZE: usize = 20;
|
||||
pub const IMAGES_PER_TAG: usize = 8;
|
||||
|
@ -351,7 +352,12 @@ impl Store {
|
|||
}
|
||||
|
||||
pub async fn save_host(&mut self, host: &str) -> Result<(), RedisError> {
|
||||
redis::Cmd::set(format!("h:{}", host), "1")
|
||||
let key = format!("h:{}", host);
|
||||
redis::pipe()
|
||||
.set(&key, "1")
|
||||
.ignore()
|
||||
.expire(&key, HOST_EXPIRE)
|
||||
.ignore()
|
||||
.query_async::<_, ()>(self)
|
||||
.await
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user