On Wednesday, April 13, 2011 8:31:05 PM UTC-4, 黄祥 wrote:
>
> pardon me, for not explain it more clearly, when i put *cache =
> (cache.ram, 60)* the new data is not show immediately after i inserted it,
> after a few minutes, it will appears, but when i delete *cache =
> (cache.ram, 60)*, the new data is show immediately after i inserted it. is
> it the behaviour of cache or there is something wrong in my code function?
>
I'm still not sure exactly what the problem is. When you first display the
results of the query, it will store the query results in the cache for the
period specified (60 seconds in your case). If you then insert some new data
and run the query again before the cache expires, it will not show the new
data -- it will just show the cached data. It won't run the query again (and
pull the new data) until the initial cache time expires. Are you waiting at
least 60 seconds after the first query before checking again for updated
data?
Anthony