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

Frank van Lankvelt f.vanlankvelt at 1hippo.com
Mon Dec 24 01:30:54 CET 2012


On 21 dec. 2012, at 13:32, Ard Schrijvers <a.schrijvers at onehippo.com> wrote:

> On Fri, Dec 21, 2012 at 1:07 PM, Frank van Lankvelt
> <f.vanlankvelt at onehippo.com> wrote:
>> 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())) {
> 
> Does this also already work for scheduled publish and unpublish? The
> problem when I look at it before was that in that case the methodName
> would only be something like 'request' IIRC
> 
It should post events for publish, please file an issue if this this does not work.

Cheers, Frank

> Regards Ard
> 
>>                  // 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
>> _______________________________________________
>> 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
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html


More information about the Hippo-cms7-user mailing list