I should add that one can always do

    cache.ram('whetever',lambda: cache.ram.clear(), 5*60)

to clear all cache every 5 minutes. Clear also takes a regex and can be 
used for partial cache clear.

    cache.ram('whetever',lambda: cache.ram.clear(regex), 5*60)

cache.ram cannot clear cache automatically because it is not aware of how 
much memory is being used. Yet if you use apache (and I I think uwsgi 
also), the web server will automatically kill and re-spawn processes that 
use too much memory.




On Sunday, 4 August 2013 17:42:09 UTC-5, Massimo Di Pierro wrote:
>
> If the query depends on user input than yes.
> select(cache=(...)) uses the SQL QUERY as key. If it is possible for the 
> QUERY that you are caching to always be different because depends on user 
> this input you have a memory leak. Actually more than that. You have a DoS 
> vulnerability because a user can keep making queries thus exploiting the 
> leak easily.
>
> You should only cache selects that do not depend on use input.
>
>
> On Sunday, 4 August 2013 16:55:08 UTC-5, Loïc wrote:
>>
>> Thank you Anthony.
>>
>> Maybe I missed a point in the book, but does memory leak with cache.ram 
>> also applies to select caching?
>> For example when you do 
>>
>> rows = db(query).select(cache=(cache.ram,3600),cacheable=True)
>>
>> Is there any way to specify the key, or to empty the cache after some 
>> time?
>> What is the "correct" way to do?
>>
>>
>> Thank you
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to