public class CmsFlexBucketConfiguration extends java.lang.Object
This consists of a list of flex bucket definitions, and a 'clear all' list.
Each flex bucket definition consists of a name and a list of paths. If any resources from the given list of paths or their descendants is published, the corresponding Flex bucket's contents should be removed from the Flex cache. If a resource with its path below one of the paths from the 'clear all' list is published, the complete Flex cache should be cleared.
Modifier and Type | Class and Description |
---|---|
class |
CmsFlexBucketConfiguration.BucketSet
A data structure representing a set of Flex cache buckets.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUCKET_OTHER
Special bucket name for everything that doesn't belong in any other bucket.
|
static java.lang.String |
KEY_CLEAR_ALL
Configuration key for the list of folders for which the whole flex cache should be purged when a resource in them is published.
|
static java.lang.String |
KEY_PREFIX_BUCKET
The configuration key prefix used to define a bucket.
|
Constructor and Description |
---|
CmsFlexBucketConfiguration() |
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String key,
java.util.List<java.lang.String> values)
Adds a flex bucket definition, consisting of a flex bucket name and a list of paths.
|
void |
freeze()
Freeze the bucket configuration, i.e. make it non-modifiable.
|
java.lang.String |
getBucketName(int bitIndex)
Gets the bucket name for the given bit index.
|
CmsFlexBucketConfiguration.BucketSet |
getBucketSet(java.lang.Iterable<java.lang.String> paths)
Computes the bucket set for a set of paths based on this configuration.
|
static CmsFlexBucketConfiguration |
loadFromProperties(java.util.Properties properties)
Loads the flex bucket configuration from a java.util.Properties instance.
|
static CmsFlexBucketConfiguration |
loadFromVfsFile(CmsObject cms,
java.lang.String path)
Loads a flex bucket configuration from the OpenCms VFS.
|
void |
setClearAll(java.util.List<java.lang.String> clearAll)
Sets the 'clear all' list, a list of paths for which the complete Flex cache should be cleared if any resource
below them is published.
|
boolean |
shouldClearAll(java.util.List<CmsPublishedResource> publishedResources)
Returns true if for the given publish list, the complete Flex cache should be cleared based on this configuration.
|
public static final java.lang.String BUCKET_OTHER
public static final java.lang.String KEY_CLEAR_ALL
public static final java.lang.String KEY_PREFIX_BUCKET
public CmsFlexBucketConfiguration()
public static CmsFlexBucketConfiguration loadFromProperties(java.util.Properties properties)
properties
- the properties from which to load the configurationpublic static CmsFlexBucketConfiguration loadFromVfsFile(CmsObject cms, java.lang.String path) throws CmsException
cms
- the CMS context to use for VFS operationspath
- the path of the resourceCmsException
- if something goes wrongpublic void add(java.lang.String key, java.util.List<java.lang.String> values)
key
- the flex bucket namevalues
- the flex bucket pathspublic void freeze()
public java.lang.String getBucketName(int bitIndex)
bitIndex
- the bit index for the bucket in the bit set representation.public CmsFlexBucketConfiguration.BucketSet getBucketSet(java.lang.Iterable<java.lang.String> paths)
The resulting bucket set contains all buckets for which one of the given paths is below the configured roots of that bucket.
paths
- a list of root pathspublic void setClearAll(java.util.List<java.lang.String> clearAll)
clearAll
- a list of pathspublic boolean shouldClearAll(java.util.List<CmsPublishedResource> publishedResources)
publishedResources
- a publish list