Class CachingResourceVersion
- java.lang.Object
-
- org.apache.wicket.request.resource.caching.version.CachingResourceVersion
-
- All Implemented Interfaces:
IResourceVersion
public class CachingResourceVersion extends java.lang.Object implements IResourceVersion
Caches the results of a delegatingIResourceVersioninstance in a member variable. The cache will be valid for the lifetime of this instance. It will expire the oldest entries if the maximum number of entries is exceeded.- Since:
- 1.5
-
-
Constructor Summary
Constructors Constructor Description CachingResourceVersion(IResourceVersion delegate)create version cacheCachingResourceVersion(IResourceVersion delegate, int maxEntries)create version cache
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetVersion(IStaticCacheableResource resource)get unique string identifying the version of the resourcejava.util.regex.PatterngetVersionPattern()a pattern that matches returned versionsvoidinvalidate(IStaticCacheableResource resource)remove cacheable resource from cachevoidinvalidateAll()
-
-
-
Constructor Detail
-
CachingResourceVersion
public CachingResourceVersion(IResourceVersion delegate)
create version cache the cache will accept up to 5000 before evicting the oldest entries.- Parameters:
delegate- delegating resource version provider
-
CachingResourceVersion
public CachingResourceVersion(IResourceVersion delegate, int maxEntries)
create version cache the cache will accept a maximum number of entries specified bymaxEntriesbefore evicting the oldest entries.- Parameters:
delegate- resource version providermaxEntries- maximum number of cache entries
-
-
Method Detail
-
getVersion
public java.lang.String getVersion(IStaticCacheableResource resource)
Description copied from interface:IResourceVersionget unique string identifying the version of the resource- Specified by:
getVersionin interfaceIResourceVersion- Parameters:
resource- cacheable resource- Returns:
- unique version string or
nullif version string could not be calculated
-
getVersionPattern
public java.util.regex.Pattern getVersionPattern()
Description copied from interface:IResourceVersiona pattern that matches returned versions- Specified by:
getVersionPatternin interfaceIResourceVersion- Returns:
- a pattern or
nullif no pattern is available
-
invalidate
public void invalidate(IStaticCacheableResource resource)
remove cacheable resource from cache- Parameters:
resource- cacheable resource
-
invalidateAll
public void invalidateAll()
-
-