I wasn't know I could do that... Thanks
Richard On Thu, Apr 5, 2012 at 11:14 AM, Anthony <[email protected]> wrote: > Here how I do caching : >> >> dblabels_en=dict([(r.table_**name+r.column_name,r.column_**name_en_ui)\ >> for r in db().select(db.dict_database.**ALL,cache=(cache.ram,3600))]) >> >> The problem, is that I think the for and dict creation are re-executed >> each request. >> > > Why don't you just store the final dict in the cache instead of caching > the select: > > dblabels_en = cache.ram('dblabels_en', > lambda: dict([(r.table_name + r.column_name, r.column_name_en_ui) > for r in db().select(db.dict_database.ALL)]), > time_expire=3600) > > Anthony >

