I haven't found SecurityCacheRulesInvalidatorListener class/interface and
implemented it in the following (code below). Can I clean cache like this?

public class CleanCacheEvent extends AbstractWikiEvent {
   public CleanCacheEvent(){
      super();
   }
}

@Component
@Named("SecurityCacheRulesInvalidatorListener")
@Singleton
public class CustomSecurityCacheRulesInvalidatorListener extends
AbstractEventListener {
    @Inject
    private SecurityCache securityCache;

    @Inject
    private SecurityReferenceFactory securityReferenceFactory;

    public CustomSecurityCacheRulesInvalidatorListener() {
        super("SecurityCacheRulesInvalidatorListener", new
CleanCacheEvent());
    }

    public void onEvent(Event event, Object source, Object data) {
        System.out.println("on invalidator listener event");
        SecurityReference root =
securityReferenceFactory.newEntityReference(null);
        securityCache.remove(root);
        System.out.println("cache was cleaned");
    }
}



--
View this message in context: 
http://xwiki.475771.n2.nabble.com/How-to-invalidate-security-cache-tp7599138p7599203.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to