Hi,
I am new to web2py these 2 days, while i am confused about how to update
the cached value when i read the manual, the below section.
as it explains:
*the value "Hello" will be retrieved from the cache, and it will not be
updated with "Goodbye"*.
Does it means the second statement just have set the time_expire, not
update the value with "Goodbye"?
Does it means "Hello" exists still after 5 second set in the first
statement ?
How to update the cached vaule if want, like to set "Goodbye" to replace
"Hello"?
Thanks
Note, time_expire is used to compare the current time with the time the
requested object was last saved in the cache. It does not affect future
requests.
This enables time_expire to be set dynamically when an object is requested
rather than being fixed when the object is saved. For example:
1 message = cache.ram('message', lambda: 'Hello', time_expire=5)
Now, suppose the following call is made 10 seconds after the above call:
2 message = cache.ram('message', lambda: 'Goodbye', time_expire=20)
Because time_expire is set to 20 seconds in the second call and only 10
seconds has elapsed since the message was first saved, *the value "Hello"
will be
retrieved from the cache, and it will not be updated with "Goodbye"*. The
time_expire value of 5 seconds in the first call has no impact on the
second call.