update deps and switch to upsert (thank god)
This commit is contained in:
parent
0663b7d4d5
commit
bf6a7ade5a
2 changed files with 598 additions and 318 deletions
885
Cargo.lock
generated
885
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -79,28 +79,17 @@ impl Cache {
|
||||||
mtime: u64,
|
mtime: u64,
|
||||||
rendered: Arc<str>,
|
rendered: Arc<str>,
|
||||||
extra: u64,
|
extra: u64,
|
||||||
) -> Result<(), (CacheKey, (PostMetadata, Arc<str>))> {
|
) -> Option<CacheValue> {
|
||||||
let key = CacheKey { name, extra };
|
self.0
|
||||||
|
.upsert_async(
|
||||||
let value = CacheValue {
|
CacheKey { name, extra },
|
||||||
meta: metadata,
|
CacheValue {
|
||||||
body: rendered,
|
meta: metadata,
|
||||||
mtime,
|
body: rendered,
|
||||||
};
|
mtime,
|
||||||
|
},
|
||||||
if self
|
)
|
||||||
.0
|
|
||||||
.update_async(&key, |_, _| value.clone())
|
|
||||||
.await
|
.await
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
self.0
|
|
||||||
.insert_async(key, value)
|
|
||||||
.await
|
|
||||||
.map_err(|x| (x.0, (x.1.meta, x.1.body)))
|
|
||||||
} else {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
|
Loading…
Reference in a new issue