you can certainly do
STORE_DETAILS = db(db.stores.user_id == auth.user_id).select()
in models.
You'd have the variable STORE_DETAILS available in all controllers and
every time a user loads a page the data will be refreshed.
In order to reduce the db pressure, you can
STORE_DETAILS = db(db.stores.user_id ==
auth.user_id).select(cache=(cache.ram, 60))
Doing so, the 2nd select will be fired only if more than 60 seconds passed
from the 1st (i.e. a new page requested by the same user within 60 seconds
will be fetched from the cache and not from the db)
What you are doing in php works for web2py also: if you are positive that
once a user is logged-in he would get the same stores forever (so it's not
necessary to fetch the data every time you load the page), you can cache it
with a high number or simply store the store details in session, i.e.
if not session.store_details: #so it will be fetched one time only, if no
store_details "key" is found on session
store_details = db(db.stores.user_id == auth.user_id).select()
Then you'd have to access this data as session.store_details
That's all if I got it correctly: if I didn't understand please post more
details.
--