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
If the _id can be configure, it's easy to realize distributed cache.
Looking forward to your reply, thank you for your great work!
Such as MongoDB
result
If the
_id
can be configure, it's easy to realize distributed cache.Looking forward to your reply, thank you for your great work!