Class ConfluenceVelocityResourceCache
- java.lang.Object
-
- com.atlassian.confluence.util.velocity.ConfluenceVelocityResourceCache
-
- All Implemented Interfaces:
org.apache.velocity.runtime.resource.ResourceCache
public class ConfluenceVelocityResourceCache extends Object implements org.apache.velocity.runtime.resource.ResourceCache
Clearable velocity cache.We configure velocity to use this cache, then we can get at the static methods to globally remove things from the cache if we need to. This is necessary for the dynamic decorator stuff.
-
-
Constructor Summary
Constructors Constructor Description ConfluenceVelocityResourceCache(com.atlassian.vcache.VCacheFactory cacheFactory)
Deprecated.since 7.20
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Iterator<?>
enumerateKeys()
org.apache.velocity.runtime.resource.Resource
get(@NonNull Object key)
static ConfluenceVelocityResourceCache
getInstance()
Get the Confluence resource cache singleton.void
initialize(@NonNull org.apache.velocity.runtime.RuntimeServices velocityServices)
org.apache.velocity.runtime.resource.Resource
put(@NonNull Object key, @Nullable org.apache.velocity.runtime.resource.Resource resource)
org.apache.velocity.runtime.resource.Resource
remove(@NonNull Object key)
static void
removeFromCaches(@NonNull Object key)
Remove a particular object from the cache
-
-
-
Constructor Detail
-
ConfluenceVelocityResourceCache
@Deprecated public ConfluenceVelocityResourceCache(com.atlassian.vcache.VCacheFactory cacheFactory)
Deprecated.since 7.20Create a resource cache using the provided cache manager. Everytime this is called, the resource cache singleton is replaced with the newly provided instance. There should only ever be one of these created but as we don't have control over the creating code (Struts VelocityManager), we can't enforce singleton use via a factory method.
-
-
Method Detail
-
getInstance
public static ConfluenceVelocityResourceCache getInstance()
Get the Confluence resource cache singleton.- Returns:
- Resource cache singleton, may be null if Confluence caching has not been initialised.
-
removeFromCaches
public static void removeFromCaches(@NonNull Object key)
Remove a particular object from the cache- Parameters:
key
- the cache-key to remove. Any cached object with a key that has this key as a substring will be removed, for safety's sake.
-
initialize
public void initialize(@NonNull org.apache.velocity.runtime.RuntimeServices velocityServices)
- Specified by:
initialize
in interfaceorg.apache.velocity.runtime.resource.ResourceCache
-
get
public org.apache.velocity.runtime.resource.Resource get(@NonNull Object key)
- Specified by:
get
in interfaceorg.apache.velocity.runtime.resource.ResourceCache
-
put
public org.apache.velocity.runtime.resource.Resource put(@NonNull Object key, @Nullable org.apache.velocity.runtime.resource.Resource resource)
- Specified by:
put
in interfaceorg.apache.velocity.runtime.resource.ResourceCache
-
remove
public org.apache.velocity.runtime.resource.Resource remove(@NonNull Object key)
- Specified by:
remove
in interfaceorg.apache.velocity.runtime.resource.ResourceCache
-
enumerateKeys
public Iterator<?> enumerateKeys()
- Specified by:
enumerateKeys
in interfaceorg.apache.velocity.runtime.resource.ResourceCache
-
clear
public void clear()
-
-