feat: room(分区)

This commit is contained in:
2022-08-19 09:59:44 +08:00
parent dbb5732938
commit 0e1a088575
10 changed files with 66 additions and 16 deletions

View File

@@ -172,17 +172,24 @@ impl PostCommentCache {
}
}
pub struct PostListCommentCache {
pub struct PostListCache {
key: String,
mode: u8,
rconn: RdsConn,
length: isize,
}
impl PostListCommentCache {
pub fn init(mode: u8, rconn: &RdsConn) -> Self {
impl PostListCache {
pub fn init(room_id: Option<i32>, mode: u8, rconn: &RdsConn) -> Self {
Self {
key: format!("hole_v2:cache:post_list:{}", &mode),
key: format!(
"hole_v2:cache:post_list:{}:{}",
match room_id {
Some(i) => i.to_string(),
None => "".to_owned(),
},
&mode
),
mode,
rconn: rconn.clone(),
length: 0,