Ive adapted the code to use cache.ram, but the docs about this mechanism is
quite confusing, and i can't get it to work.
There are several questions like,
how to store simple values instead callables?
what happens if i access a cache value after expiration?
This is the code:
def getprogress():
print "progress", cache.ram.storage['message'][1]
return cache.ram.storage['message'][1]
def progress():
# when a form is submitted, change progress each second
if request.post_vars:
for i in range(5):
message = cache.ram('message', lambda: i, time_expire=1)
print "main:", message
sleep(1)
return "done"
else:
message = cache.ram('message', lambda: -1, time_expire=1)
return locals()
Something weird happens at the python console
print "progress", cache.ram.storage['message'][1]
doesnt get printed on its own line, but the important thing is that im not
accessing the declared message value.
And i get a log like this
progress progress progress progress main: 0
progress main: 1
progress progress progress main: 2
progress main: 3
progress main: 4
progress
Any idea on what's wrong?
Thanks
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.