>
>    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"?
>

Yes, in that example, the second statement would not update the value to 
"Goodbye" because the previous value was stored only 10 seconds ago, and 
the cache call with "Goodbye" requires a time_expire of 20 seconds before 
replacing the previous value. If the second call were made at least 20 
seconds after the first call, then the value would be updated to "Goodbye".
 

>    Does it means "Hello" exists still after 5 second set in the first 
> statement ? 
>

Yes. The time_expire set in the first statement does not determine how long 
that new value stays in the cache. Rather, it determines whether that new 
value will replace any previously existing value (i.e., if the time since 
the previous value was saved exceeds time_expire, then the new value is 
written -- otherwise, the previous value is retrieved).
 

>    How to update the cached vaule if want, like to set "Goodbye" to 
> replace "Hello"?
>

Hopefully this is clear now -- as long as the time_expire value in the 
"Goodbye" call is less than the actual time that has expired since the 
previous value was saved, "Goodbye" will replace the previous value.

Anthony

Reply via email to