You need to understand why it is show. It is show to load the age or
to load the pictures (because there are lots of the m in the page)?
caching the select only affect the time to download the html page but
does not affect the pictures since you are caching the list of
function names not not the actual pictures.
I suspect that the problem is that the system is doing database access
for each picture (that is what download() does), in order to check
whether the user is allowed to view the picture. If you do not need to
validate each picture, you can write your own download function that
does not perform validation and only does streaming or (better) you
can ask web2py to bypass web2py and serve images directly.
On May 4, 2010, at 6:36 PM, Yannick wrote:
Hello mate,
I used a lot of pictures in my application. Currently what I'm doing
is I cache the DAL Select like this:
"db(....).select(db.photo.fileupload, db.photo.id, cache=(cache.ram,
3600))"
And when the users upload new pictures, in the "onaccept" function I
clear the cache like this:
- cache.ram.clear()
So that the cache will be refreshed when the user load back the
pictures again.
- First, I want to know if it is a good approach ?
- Second, it is a better way to improve this design to make my system
faster ? (Because it is still a bit slow)
- Third, when I do this "cache.ram.clear" it actually clear the cache
for all users sessions, how can I only clear the cache of a single
user session NOT all of them ???
Please let me know.
Cheers,
Yannick P.