Hi Andrey,

Looks good to me.
Regards,


On Wed, Apr 27, 2016 at 5:53 PM, abtv <[email protected]> wrote:

> Hi Denis!
>
> Did you inserted code example to show how to use ReadWriteLock in place? Or
> I should override the default class? I just added ReadWriteLock, is it ok?
>
> There is my final solution with Listener and it works on my machine:
>
> I added the following to components.txt:
> 0:com.myproject.xwiki.cache.CustomSecurityCacheRulesInvalidatorListener
>
> @Component
> @Named("SecurityCacheRulesInvalidatorListener")
> @Singleton
> public class CustomSecurityCacheRulesInvalidatorListener extends
> AbstractEventListener {
>     @Inject
>     @Named(DefaultSecurityCacheRulesInvalidator.NAME)
>     private ReadWriteLock readWriteLock;
>     @Inject
>     private SecurityCache securityCache;
>
>     @Inject
>     private SecurityReferenceFactory securityReferenceFactory;
>
>     public CustomSecurityCacheRulesInvalidatorListener() {
>         super(DefaultSecurityCacheRulesInvalidator.NAME, new
> CleanCacheEvent());
>     }
>
>     public void onEvent(Event event, Object source, Object data) {
>         System.out.println("invalidating xwiki cache");
>         readWriteLock.writeLock().lock();
>         try {
>             SecurityReference root =
> securityReferenceFactory.newEntityReference(null);
>             securityCache.remove(root);
>         } finally {
>             readWriteLock.writeLock().unlock();
>         }
>     }
> }
>
>
>
> --
> View this message in context:
> http://xwiki.475771.n2.nabble.com/How-to-invalidate-security-cache-tp7599138p7599252.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>



-- 
Denis Gervalle
SOFTEC sa - CEO
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to