>
> 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