Class MaxAgePolicy
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.cache.MaxAgePolicy
-
- All Implemented Interfaces:
RetentionPolicy<Identifier,CachedObject>
public class MaxAgePolicy extends Object implements RetentionPolicy<Identifier,CachedObject>
A retention policy that removes objects that have been in the cache for too long.Created by Jeff Gaynor
on Nov 12, 2010 at 10:21:04 AM
-
-
Constructor Summary
Constructors Constructor Description MaxAgePolicy(Cache cache, long maximumAge)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
applies()
If this applies to the current cache.Cache
getMap()
The cache to which this policy is applied.long
getMaximumAge()
boolean
retain(Identifier key, CachedObject cachedObject)
void
setMap(Cache map)
void
setMaximumAge(long maximumAge)
-
-
-
Constructor Detail
-
MaxAgePolicy
public MaxAgePolicy(Cache cache, long maximumAge)
-
-
Method Detail
-
getMaximumAge
public long getMaximumAge()
-
setMaximumAge
public void setMaximumAge(long maximumAge)
-
setMap
public void setMap(Cache map)
-
getMap
public Cache getMap()
Description copied from interface:RetentionPolicy
The cache to which this policy is applied.- Specified by:
getMap
in interfaceRetentionPolicy<Identifier,CachedObject>
- Returns:
-
retain
public boolean retain(Identifier key, CachedObject cachedObject)
- Specified by:
retain
in interfaceRetentionPolicy<Identifier,CachedObject>
-
applies
public boolean applies()
Description copied from interface:RetentionPolicy
If this applies to the current cache. While this is true, theRetentionPolicy.retain(Object, Object)
method will be applied to each element of the cache. When false, this policy will be skipped.
E.g. for a cache that limits the number of cached items, there is no reason to check every item in the cache directly if the cache size is below a certain threshold.- Specified by:
applies
in interfaceRetentionPolicy<Identifier,CachedObject>
- Returns:
-
-