Closed 0verbyte closed 5 years ago
As a second step (or task rather) if the command has enabled caching, a flag should be added dynamically that allows the user to clear the items in the cache.
Additionally, I like the idea of dynamically making it possible to clear the cache of all or certain commands. As I see it there are two approaches:
cache
command that can list number of entries per command, and sub-commands to clear cache of all or a selection of commands, or--clear-cache
or similar. But this won't make it easy to clear all cache very easilyLooks great. The cache is living in memory only, right?
Yep, the cache is in-memory. If the command allows caching it will have its own TTLCache
, cache will not be shared with other commands.
I've made the general improvements around how caching keys are generated and looked up.
Regarding clearing command caches. I agree with both of these approaches, perhaps we implement both? I think it is important that each command has the ability to clear its own cache when running with additional arguments. e.g. if you wanted to clear the cache for users.list
so you make a fresh api call and cache the new response without executing two separate commands to clear the cache.
This is great, thanks!
Regarding clearing command caches. I agree with both of these approaches, perhaps we implement both?
Yeah, that's a good point. Should do that in another PR.
Fixes #105.
Changes proposed in this pull request:
TTLCache
from thecachetools
library.users.list
.