blog: use build timestamp as CACHE_VERSION
This commit is contained in:
parent
311b9a0d26
commit
54ca223ed6
16
src/blog.rs
16
src/blog.rs
|
@ -7,6 +7,7 @@
|
||||||
use crate::store;
|
use crate::store;
|
||||||
use crate::utils::*;
|
use crate::utils::*;
|
||||||
use pulldown_cmark::*;
|
use pulldown_cmark::*;
|
||||||
|
use rbtag::BuildDateTime;
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
|
@ -115,12 +116,13 @@ impl Post {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should be bumped each time the parsing / compiling
|
lazy_static! {
|
||||||
// logic of Markdown changes, and each time the Markdown
|
// Whenever this is changed, all cache will be invalided
|
||||||
// library updates. Updaing this value invalidates all
|
// Use build timestamp string
|
||||||
// existing cache and they will be recompiled when someone
|
static ref CACHE_VERSION: String = {
|
||||||
// visits.
|
format!("{}", BuildTag{}.get_build_timestamp())
|
||||||
const CACHE_VERSION: &'static str = "0017";
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// The prefix path used for caching remote images
|
// The prefix path used for caching remote images
|
||||||
pub const IMG_CACHE_PREFIX: &'static str = "/imgcache/";
|
pub const IMG_CACHE_PREFIX: &'static str = "/imgcache/";
|
||||||
|
@ -187,7 +189,7 @@ impl PostContentCache {
|
||||||
Err(_) => return None
|
Err(_) => return None
|
||||||
};
|
};
|
||||||
|
|
||||||
if cache.version != CACHE_VERSION {
|
if cache.version != *CACHE_VERSION {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue