Hi all,
I have this use-case:
There is a set of rows being queried from the database.
videos=db(db.video.id>0).select()
Now I have three different views (in same controller) where I want to
access these rows (with additional filters), but I want to prevent
multiple db calls.
def index():
# use videos here with an additional filter
home_videos = [v for v in videos if v.folder == 'home']
def favorites():
fav_videos = [v for v in videos if v.folder == 'favorites']
These views essentially fetch subset of the same dataset and display
them.
Question:
-------------
Is there a way to "cache" the first db call "videos = ... " and be
able to access "videos" variable without hitting database again, as
long as this session exists?
I am not sure if and how I can use global variables here, and will
they reliably persist.