apply cache tll properly and slightly change date rendering
This commit is contained in:
parent
c9bbb5234e
commit
01bc3ae4ae
2 changed files with 9 additions and 2 deletions
|
@ -33,6 +33,7 @@ pub struct CacheValue {
|
||||||
pub struct Cache {
|
pub struct Cache {
|
||||||
map: HashMap<CacheKey, CacheValue>,
|
map: HashMap<CacheKey, CacheValue>,
|
||||||
version: u16,
|
version: u16,
|
||||||
|
#[serde(skip)]
|
||||||
ttl: Option<NonZeroU64>,
|
ttl: Option<NonZeroU64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,5 +279,10 @@ pub(crate) async fn load_cache(config: &CacheConfig) -> Result<Cache, eyre::Repo
|
||||||
buf
|
buf
|
||||||
};
|
};
|
||||||
|
|
||||||
bitcode::deserialize(serialized.as_slice()).context("failed to parse cache")
|
let mut cache: Cache =
|
||||||
|
bitcode::deserialize(serialized.as_slice()).context("failed to parse cache")?;
|
||||||
|
|
||||||
|
cache.ttl = config.ttl;
|
||||||
|
|
||||||
|
Ok(cache)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
function replaceDates() {
|
function replaceDates() {
|
||||||
for (let el of document.querySelectorAll(".date-rfc3339")) {
|
for (let el of document.querySelectorAll(".date-rfc3339")) {
|
||||||
let date = new Date(Date.parse(el.textContent));
|
let date = new Date(Date.parse(el.textContent));
|
||||||
|
el.title = el.textContent;
|
||||||
el.textContent = date.toLocaleString();
|
el.textContent = date.toLocaleString();
|
||||||
el.classList.remove("date-rfc3339");
|
el.classList.replace("date-rfc3339", "tooltipped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue