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

Implement multiple backend option #14

Open
lucasrcezimbra opened this issue Jul 31, 2022 · 0 comments
Open

Implement multiple backend option #14

lucasrcezimbra opened this issue Jul 31, 2022 · 0 comments

Comments

@lucasrcezimbra
Copy link
Member

lucasrcezimbra commented Jul 31, 2022

https://github.com/HBN3tw0rk/dcache/tree/master#multiple-backends

Ideia:

from dcache import dcache
from dcache.backends import InMemoryBackend, RedisBackend

@dcache(multiple=[
    InMemoryBackend(),
    RedisBackend(host='localhost', port=6379, db=0),
])
def slow_function(n):
        return n ** 1000
  1. search on the in-memory cache;
  2. if exists, return, if not, search on Redis;
    • if exists on Redis, save in memory and return;
    • if not, exists on Redis, run the slow_function, save on Redis, save in-memory and return;
  • doesn't run if already returned
@lucasrcezimbra lucasrcezimbra changed the title Implement multiple option Implement multiple backend option Jul 31, 2022
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

No branches or pull requests

1 participant