On 10/14/05, Michael Peters <[EMAIL PROTECTED]> wrote:
> I also think having caching on the run mode level would help CAF out
> with 'Embedded Components'. This way you could cache some of the
> semi-dynamic portions of page but putting it into another 'Cacheable'
> run mode.

I think perhaps the implementation should not just focus on runmodes,
but allow all methods.  That turns it into a sort of memoize with
expiries.

I think what would be most difficult though is deciding what is
cachable based on dynamic patterns (ie something might only be
cachable on a per user basis).

What if the user were to write a simple method that defined all the
dynamic elements for the current request, and the Cachable methods
configured which ones they depended on:

sub dynamic {
  my $self = shift;
  return {
    username => $self->authen->username,
    product_id => $self->query->param('product_id');
  };
}

# cache should consider the username parameter when retrieving the page
sub my_homepage :Cache( 10min, username ) { ... }

# cache should consider the product_id parameter
sub view_product :Cache( 30min, product_id ) { ... }

# cache should consider the product_id parameter and username parameter
sub buy_product :Cache( 30min, product_id, username ) { ... }


That is a pretty rough concept, but it would give the caching system
an idea of what to look for to decide what is cachable.  For the
view_product page, you could potentially have an entry for every
product in the cache.


Another caching aspect that I like is permanent caches that are only
expired when a change to the underlying data is made.  Using the
product example above, the product description and details will
probably not change in the next 30 minutes.  So why can't we cache it
permanently, and invalidate the cache when a product update is
performed by the administrator.

Caching is not a simple topic, but it can be extremely useful in
reducing load on your server.  It can also mess up your app very
quickly if used incorrectly.

Cheers,

Cees

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to