SEC-1054: Add method "clear" to interface AclCache. As requested.

This commit is contained in:
Luke Taylor 2009-03-16 09:31:52 +00:00
parent ccf422af5a
commit 766aca885b
2 changed files with 8 additions and 2 deletions

View File

@ -39,4 +39,6 @@ public interface AclCache {
MutableAcl getFromCache(Serializable pk); MutableAcl getFromCache(Serializable pk);
void putInCache(MutableAcl acl); void putInCache(MutableAcl acl);
void clearCache();
} }

View File

@ -31,7 +31,7 @@ import org.springframework.util.Assert;
/** /**
* Simple implementation of {@link AclCache} that delegates to EH-CACHE. * Simple implementation of {@link AclCache} that delegates to EH-CACHE.
* *
* <p> * <p>
* Designed to handle the transient fields in {@link AclImpl}. Note that this implementation assumes all * 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. * {@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); this.auditLogger = (AuditLogger) FieldUtils.getProtectedFieldValue("auditLogger", acl);
} }
} }
if ((acl.getParentAcl() != null) && (acl.getParentAcl() instanceof MutableAcl)) { if ((acl.getParentAcl() != null) && (acl.getParentAcl() instanceof MutableAcl)) {
putInCache((MutableAcl) acl.getParentAcl()); putInCache((MutableAcl) acl.getParentAcl());
} }
@ -137,4 +137,8 @@ public class EhCacheBasedAclCache implements AclCache {
} }
return value; return value;
} }
public void clearCache() {
cache.removeAll();
}
} }