[Hippo-cms7-user] Invalidating cached properties upon publication of changes

Frank van Lankvelt f.vanlankvelt at onehippo.com
Fri Dec 21 13:07:44 CET 2012


On Fri, Dec 21, 2012 at 12:17 PM, Tobias Jeger <t.jeger at onehippo.com> wrote:
> Hi,
>
> my project is using the properties plug-in, and we experienced caching
> problems. During the
> analysis, I see that the event-listener used for invalidating cache entries
> operates at the JCR
> level, and therefore fires many more events at the listener than I consider
> necessary.
>
> As the cache invalidation should logically be tied to the fact that the
> document has changed,
> which, for the live version of the document, means that it has been
> (un-)published, I wonder if there
> is an event-listener mechanism available at the workflow level, which would
> fire a single event for the
> fact that a document has been saved / (un-)published / deleted. Does such a
> mechanism exist?
>
it does exist in Hippo CMS 7.8.  You can register a listener to the
Hippo event bus.

You could try something like this:

  HippoServiceRegistry.registerService(new Object() {

    @Subscribe
    public void handleEvent(HippoEvent event) {
        if (HippoEventConstants.CATEGORY_WORKFLOW.equals(event.category())) {
            HippoWorkflowEvent workflowEvent = new HippoWorkflowEvent(event);
            if ("publish".equals(workflowEvent.methodName())) {
                  // further checks to filter events, e.g. for document path
                  ... invalidate cache ...
            }
        }
     }
  }, HippoEventBus.class);

cheers, Frank

> I'm at CMS 7.7.
>
> thanks
>
> Tobi
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com


More information about the Hippo-cms7-user mailing list