public class ResourceCacheImpl extends Object implements ResourceCache
resource.manager.cache.size property (identified by the
RuntimeConstants.RESOURCE_MANAGER_DEFAULTCACHE_SIZE
constant). This property get be set to 0 or less for
a greedy, unbounded cache (the behavior from pre-v1.5).| Modifier and Type | Field and Description |
|---|---|
protected Map<Object,Resource> |
cache
Cache storage, assumed to be thread-safe.
|
protected org.slf4j.Logger |
log |
protected RuntimeServices |
rsvc
Runtime services, generally initialized by the
initialize() method. |
| Constructor and Description |
|---|
ResourceCacheImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all of the resources from this cache.
|
Iterator<Object> |
enumerateKeys()
returns an Iterator of Keys in the cache.
|
Resource |
get(Object key)
retrieves a Resource from the
cache
|
void |
initialize(RuntimeServices rs)
initializes the ResourceCache.
|
Resource |
put(Object key,
Resource value)
stores a Resource in the cache
|
Resource |
remove(Object key)
removes a Resource from the cache
|
protected RuntimeServices rsvc
initialize() method.protected org.slf4j.Logger log
public void initialize(RuntimeServices rs)
ResourceCacheinitialize in interface ResourceCachers - RuntimeServices to use for logging, etcResourceCache.initialize(org.apache.velocity.runtime.RuntimeServices)public Resource get(Object key)
ResourceCacheget in interface ResourceCachekey - key for Resource to be retrievedResourceCache.get(java.lang.Object)public Resource put(Object key, Resource value)
ResourceCacheput in interface ResourceCachekey - key to associate with the Resourcevalue - Resource to be storedResourceCache.put(java.lang.Object, org.apache.velocity.runtime.resource.Resource)public Resource remove(Object key)
ResourceCacheremove in interface ResourceCachekey - resource to be removedResourceCache.remove(java.lang.Object)public void clear()
ResourceCacheclear in interface ResourceCacheResourceCache.clear()public Iterator<Object> enumerateKeys()
ResourceCacheenumerateKeys in interface ResourceCacheResourceCache.enumerateKeys()Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.