Hi 


I understand the concept of cache but I don't understand the statement 
below. Would someone be willing to try and explain it to me in a different 
way (in the vain hope that I might actually understand it :-))


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:

message = cache.ram('message', lambda: 'Hello', time_expire=5)

Now, suppose the following call is made 10 seconds after the above call:

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.


thanks


Dave

-- 



Reply via email to