Ticket #854 (closed enhancement: fixed)

Opened 5 years ago

Last modified 2 years ago

Add support for cache group callbacks

Reported by: david Owned by: david
Priority: normal Milestone: 1.0
Component: filter Version:
Severity: normal Keywords: caching group callback condition
Cc: Patch attached: no

Description

<group source="callback">someMethodName</group>

That method is called on the Action instance, and can do either of two things:

  • return a scalar value (then used as the cache key for that group)
  • throw an exception

If the method throws an exception, then no caching will occur.

Some examples of when callbacks are useful:

  • you want different caches for the product depending on whether or not the current user is, say, the owner of the item (because you show more info to the owner, or edit buttons etc)
  • you don't want to cache at all if, say, the account owner visits his/her own profile (you simply throw an exception then)

Change History

Changed 5 years ago by david

  • status changed from new to closed
  • resolution set to fixed

(In [2868]) added support for cache group callbacks, closes #854. check out the ticket for details, guys, many of you will find this very useful

Changed 4 years ago by david

FYI, you need to throw an exception of class AgaviUncacheableException to suppress caching altogether (implemented in [3806], see #1032 for details)

Note: See TracTickets for help on using tickets.