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

How can I configure NamespaceManager to realize distributed cache? #194

Open
vba34520 opened this issue Aug 28, 2020 · 0 comments
Open

How can I configure NamespaceManager to realize distributed cache? #194

vba34520 opened this issue Aug 28, 2020 · 0 comments

Comments

@vba34520
Copy link

Such as MongoDB

from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options

cache_opts = {
    'cache.type': 'ext:mongodb',
    'cache.url': 'mongodb://localhost:27017/cache',
    'cache.expire': 600
}

cache = CacheManager(**parse_cache_config_options(cache_opts))


@cache.cache('fib')
def fib(n):
    if n < 2:
        return n
    return fib(n - 1) + fib(n - 2)


if __name__ == '__main__':
    result = [fib(i) for i in range(35)]
    print(result)

result

image.png

If the _id can be configure, it's easy to realize distributed cache.

Looking forward to your reply, thank you for your great work!

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