From 766aca885b94cab4e2233a31f2029eed6f296f7c Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Mon, 16 Mar 2009 09:31:52 +0000 Subject: [PATCH] SEC-1054: Add method "clear" to interface AclCache. As requested. --- .../org/springframework/security/acls/jdbc/AclCache.java | 2 ++ .../security/acls/jdbc/EhCacheBasedAclCache.java | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/acl/src/main/java/org/springframework/security/acls/jdbc/AclCache.java b/acl/src/main/java/org/springframework/security/acls/jdbc/AclCache.java index 97db73ef65..00ce30f50f 100644 --- a/acl/src/main/java/org/springframework/security/acls/jdbc/AclCache.java +++ b/acl/src/main/java/org/springframework/security/acls/jdbc/AclCache.java @@ -39,4 +39,6 @@ public interface AclCache { MutableAcl getFromCache(Serializable pk); void putInCache(MutableAcl acl); + + void clearCache(); } diff --git a/acl/src/main/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCache.java b/acl/src/main/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCache.java index 11088160bd..cb522acfdb 100644 --- a/acl/src/main/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCache.java +++ b/acl/src/main/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCache.java @@ -31,7 +31,7 @@ import org.springframework.util.Assert; /** * Simple implementation of {@link AclCache} that delegates to EH-CACHE. - * + * *

* Designed to handle the transient fields in {@link AclImpl}. Note that this implementation assumes all * {@link AclImpl} instances share the same {@link AuditLogger} and {@link AclAuthorizationStrategy} instance. @@ -121,7 +121,7 @@ public class EhCacheBasedAclCache implements AclCache { this.auditLogger = (AuditLogger) FieldUtils.getProtectedFieldValue("auditLogger", acl); } } - + if ((acl.getParentAcl() != null) && (acl.getParentAcl() instanceof MutableAcl)) { putInCache((MutableAcl) acl.getParentAcl()); } @@ -137,4 +137,8 @@ public class EhCacheBasedAclCache implements AclCache { } return value; } + + public void clearCache() { + cache.removeAll(); + } }