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)
ResourceCache
initialize
in interface ResourceCache
rs
- RuntimeServices to use for logging, etcResourceCache.initialize(org.apache.velocity.runtime.RuntimeServices)
public Resource get(Object key)
ResourceCache
get
in interface ResourceCache
key
- key for Resource to be retrievedResourceCache.get(java.lang.Object)
public Resource put(Object key, Resource value)
ResourceCache
put
in interface ResourceCache
key
- 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)
ResourceCache
remove
in interface ResourceCache
key
- resource to be removedResourceCache.remove(java.lang.Object)
public void clear()
ResourceCache
clear
in interface ResourceCache
ResourceCache.clear()
public Iterator<Object> enumerateKeys()
ResourceCache
enumerateKeys
in interface ResourceCache
ResourceCache.enumerateKeys()
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.