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