Right. My point was that you shouldn't concern yourself with getting stale 
values from the database because you cached them, and they changed short of 
the refresh interval. I have a website that caches things for 15 minutes, 
and I just tell my users that they won't see changes (on certain things) 
until 15 minutes have passed. For example, they add a new contact, the new 
contact won't be shown in the list of contacts until after 15 minutes, 
because that contact list is huge, and having to get it from the database 
every time can be slow. Now they can pass around links to the new contacts 
if they absolutely need to share it before that 15 minutes has passed, but 
otherwise, if they wait it will show up. If the 15 minute wait was getting 
too slow for them, I can of course decrease the cache time. My site has two 
layer cache as well, so not only is the data cached in ram for 15 minutes, 
but it's also cached on the browser by setting the caching options in the 
header. 95% of the time, the server can just send a 304 message.

On Friday, July 13, 2012 2:12:28 PM UTC-7, Anthony wrote:
>
> Right, you are using a ram cache, so you would have to explicitly 
>> invalidate the cached items if you want to update them. I would not rely on 
>> the time_expire to handle that for you, unless you are really not too 
>> concerned about it.
>
>
> To be clear, the cached value will reliably get updated whenever the time 
> since the previous save exceeds the current value of time_expire, so you 
> can rely on time_expire to update based on the interval it specifies. 
> Nevertheless, there may be times you want to update the cached value based 
> on something other than the time that has expired since the last update. 
> That is possible as well, though a separate issue.
>
> Anthony
>

-- 



Reply via email to