cached icon indicating copy to clipboard operation
cached copied to clipboard

Cache clear operation

Open 9999years opened this issue 1 year ago • 1 comments

Currently, there is no way to clear caches. For a DiskCache, this snippet does not seem to work (edit: the remove_expired_entries logic is broken, see #198 for a fix):

// This does not seem to work:
let lifespan = cache.cache_set_lifespan(0);
cache.remove_expired_entries();
match lifespan {
    Some(lifespan) => {
        cache.cache_set_lifespan(lifespan);
    }
    None => {
        // Uhh...
    }
}

Additionally, there's no method to remove the lifespan, so if there wasn't an expiration policy set before we called cache_set_lifespan there's no way to restore that state when we're done.

9999years avatar Apr 06 '24 18:04 9999years