I understand now. You can cache any function
http://www.web2py.com/examples/default/examples#cache_examples

You should cache the function that returns the images.

Mind that if you have a of these, caching in ram may cause a memory
leak. You probably should cache on disk or memcache (if available).

On Jan 20, 11:30 am, frollings <tluy...@gmail.com> wrote:
> Hi,
>
> No not quite it, let me try to re-explain;
>
> I have a page, per domain that we gather statistics on for our
> clients, 9 boxes with
> graphs and text (IE a bunch of HTML which happens to contain 1+ image
> each). Those 'boxes' contain content that takes time to generate (few
> seconds per box), so I want them
> to show AJAX loading. So every 'box' shows up (with it's html which is
> generated in the
> background) when it was done generating.
>
> When another user (or the same user) revisits the page within a
> settable (by the programmer)
> time-out (let's say 1 day), it should show only HTML with the content
> that was generated
> the first time using the AJAX calls.
>
> So the cache is not per session or user; it's per everyone viewing
> that page for 1 day long and then it goes to generating it again.
>
> Does that make sense?
>
> Thanks,
>
> Frank
>
> On Jan 20, 5:50 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > Let me understand better,.
>
> > You are looking at caching images. Do you want to cache per session
> > (per user) or across sessions?
> > Are you talking about cache serverside (when image is requested second
> > time it not recomputed) or clientside (the client not even try to
> > request the image the second time)? I assume the graphs are images.
> > Are they?
>
> > On Jan 20, 10:01 am, frollings <tluy...@gmail.com> wrote:
>
> > > Hi,
>
> > > I'm writing a simple statistic analysis system using web2py; when a
> > > user requests a stats page for a certain site, it will show 9 graphs.
> > > I want each of these 9 graphs to generate async (so the user sees 9
> > > loading images which, randomly, turn into graphs when that specific
> > > graph is done), but when the user re-requests, I don't want any JS/
> > > AJAX anymore but just a static HTML showing the graphs (which all have
> > > some text values as well).
>
> > > What is the best pattern in web2py to accomplish this?
>
> > > We are porting from PHP where this was implemented as a bit of a hack
> > > (pseudocode);
>
> > > if ($newload) {
>
> > >           $(".stats-visits .box-content").load('result.php', array
> > > ('id', $dom['id'], 'blk', 'stats-visits')).'");
> > > etc
> > > etc
>
> > > } else {
>
> > >  show_static($dom['id']);
>
> > > }
>
> > > I would imagine web2py has a nicer/better pattern for this kind of
> > > thing?
>
> > > Thank you
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to