I'm trying to determine whether the built-in web2py cache will fulfill
my needs or not and thus need a clarification on the following...

Based on this completely artificial example to illustrate my
questions:

someModule.py:

def ICacheLogs(cache, X):
    return db(db.log.id==X).select(db.log.ALL, cache=(cache.ram,
3600))

default.py (controller):

from someModule import ICacheLogs

def f1():
     #Verify request.vars.X and whatnot
     logs = ICacheLogs(cache, int(request.vars.X))
     #Some more logic

def f2():
     #Verify request.vars.X and whatnot
     logs = ICacheLogs(cache, int(request.vars.X))
     #Some more logic

1) If a user quickly accesses the f1 function with X set to 1 and then
again with X set to 2, will the logs result of second request be
cached on top of the logs result for first request (or worse, use the
cached result of the first request even though the parameters differ)
or will it know to cache them separately because they have different
parameters?

2) If a user quickly accesses the f1 function with X set to 1 and then
accesses the f2 function with X set to 1 also, will the logs result in
f2 be taken from the cached result from the f1 call or will it be
cached again separately because the caching is performed from a
different function in the controller?

Reply via email to