Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache clear operation #197

Open
9999years opened this issue Apr 6, 2024 · 0 comments · May be fixed by #200
Open

Cache clear operation #197

9999years opened this issue Apr 6, 2024 · 0 comments · May be fixed by #200

Comments

@9999years
Copy link
Contributor

9999years commented Apr 6, 2024

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 added a commit to 9999years/cached that referenced this issue Apr 6, 2024
This makes it possible to temporarily change a cache lifespan, or to
remove a cache lifespan once it's set. See jaemk#197 for context.
9999years added a commit to 9999years/cached that referenced this issue Apr 6, 2024
This makes it possible to temporarily change a cache lifespan, or to
remove a cache lifespan once it's set. See jaemk#197 for context.
@9999years 9999years linked a pull request Apr 6, 2024 that will close this issue
9999years added a commit to 9999years/cached that referenced this issue Apr 8, 2024
This makes it possible to temporarily change a cache lifespan, or to
remove a cache lifespan once it's set. See jaemk#197 for context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant