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

Disable decorator cache per-call #386

Closed
jcugat opened this issue Mar 12, 2018 · 3 comments
Closed

Disable decorator cache per-call #386

jcugat opened this issue Mar 12, 2018 · 3 comments
Labels

Comments

@jcugat
Copy link
Contributor

jcugat commented Mar 12, 2018

Sometimes we want to disable the cache for specific calls to a decorated method.

Adding a keyword argument (like aiocache_disable=True) that is consumed by the decorators and disables the cache for that specific call.

In this case, we don't try to load from the cache, but should we cache the result? My guess would be no, but interested in your thoughts around this.

@argaen
Copy link
Member

argaen commented Mar 12, 2018

I think it's an interesting feature to have. We could have two different args:

  • ignore_read
  • ignore write

@argaen argaen added the feature label Mar 12, 2018
@jcugat
Copy link
Contributor Author

jcugat commented Mar 15, 2018

Yeah, that's way better. So the approach would be something like:

  • aiocache_disable_read: does not try to retrieve the value from the cache, but stores the result there
  • aiocache_disable_write: tries to read from cache first, if it's found returns it. In case it's not found, makes the original call, but does not save the result in the cache.

Then we wouldn't need the general aiocache_disable param, we could obtain the same behavior disabling both read and write.

@argaen
Copy link
Member

argaen commented May 27, 2018

Closing, just merged #404. Thanks!

@argaen argaen closed this as completed May 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants