pub fn delete<'a>(
ctx: &Ctx,
key: &'a str,
) -> impl Future<Output = Result<()>> + Send + use<'a>Expand description
Removes key, e.g. after the data behind it changed (Rails’ Rails.cache.delete).
Deleting an absent key succeeds. Other locations may still read the old value for up to 60 seconds.
Free plan: counts as one KV write (1,000 a day); none with
STORE_VAR set to "null".
§Errors
Error::Internal(500) when theCACHEbinding is missing, naming the fix:ocre g cacheaddsCACHE: bindings.kv(),to cloudflare.config.ts.Error::Internalwhenkeyis empty or longer than 512 bytes.Error::Internalwhen KV rejects the delete, e.g. past the daily limit (message prefixed withLOG_PREFIX).
§Examples
use axum::extract::{Path, State};
use ocre::{Ctx, Result};
async fn update(State(ctx): State<Ctx>, Path(id): Path<i64>) -> Result<()> {
// post::update(&ctx, id, changes).await?;
ocre::cache::delete(&ctx, "posts:recent:v1").await
}