python - How to make invalidating Beaker cache work? -


i have function decorated beaker cache decorator. function located in module imported main app.

from caching import cache, my_cached_function 

now, in 1 function used decorated function:

def index():     data = my_cached_function() # no args 

in function, try invalidate cache:

def new_item():     cache.invalidate(my_cached_function, 'namespace') 

since beaker cache configured 'cache.type': 'memory', i've tried:

def new_item():     cache.invalidate(my_cached_function, 'namespace', type='memory') 

what doing wrong here?

notes

in typical scenario, call index() of time. need cache cleared whenever new_item() called, index() call take account new items created new_item() function.

the application in question web application running on top of bottle framework.

you need invalidate cache before my_cached_function called. see beaker.cache.cachemanager documentation example.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -