Package org.nuxeo.ecm.core.cache
Class CacheServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.core.cache.CacheServiceImpl
-
- All Implemented Interfaces:
CacheService
,Adaptable
,Component
,Extensible
,TimestampedService
public class CacheServiceImpl extends DefaultComponent implements CacheService
Cache service implementation to manage nuxeo cache- Since:
- 6.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CacheServiceImpl.AbstractCachePubSubInvalidator
static class
CacheServiceImpl.CacheInvalidation
protected class
CacheServiceImpl.CachePubSubInvalidator
-
Field Summary
Fields Modifier and Type Field Description static String
CACHE_INVAL_PUBSUB_TOPIC
protected Map<String,CacheManagement>
caches
Currently registered caches.static String
DEFAULT_CACHE_ID
protected CacheServiceImpl.CachePubSubInvalidator
invalidator
protected boolean
started
static String
XP_CACHES
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description CacheServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getApplicationStartedOrder()
The component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext)
.Cache
getCache(String name)
Gets the cache with the given name.CacheDescriptor
getCacheDescriptor(String descriptor)
protected void
maybeStart(String name)
void
registerCache(String name)
Programmatically registers a cache with the given name, with the the size and the timeout given by the default cache.void
registerCache(String name, int maxSize, int timeout)
Deprecated.void
start(ComponentContext context)
Start the component.protected void
startCacheDescriptor(CacheDescriptor desc)
Creates and starts the cache.void
stop(ComponentContext context)
Stop the component.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted
-
-
-
-
Field Detail
-
XP_CACHES
public static final String XP_CACHES
- Since:
- 10.3
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_ID
public static final String DEFAULT_CACHE_ID
- Since:
- 8.2
- See Also:
- Constant Field Values
-
CACHE_INVAL_PUBSUB_TOPIC
public static final String CACHE_INVAL_PUBSUB_TOPIC
- Since:
- 9.3
- See Also:
- Constant Field Values
-
started
protected boolean started
-
caches
protected final Map<String,CacheManagement> caches
Currently registered caches.
-
invalidator
protected CacheServiceImpl.CachePubSubInvalidator invalidator
-
-
Constructor Detail
-
CacheServiceImpl
public CacheServiceImpl()
-
-
Method Detail
-
registerCache
@Deprecated public void registerCache(String name, int maxSize, int timeout)
Deprecated.Description copied from interface:CacheService
Programmatically registers a cache with the given characteristics.- Specified by:
registerCache
in interfaceCacheService
- Parameters:
name
- the cache namemaxSize
- the maximum number of elementstimeout
- the entry timeout (in minutes)
-
registerCache
public void registerCache(String name)
Description copied from interface:CacheService
Programmatically registers a cache with the given name, with the the size and the timeout given by the default cache.- Specified by:
registerCache
in interfaceCacheService
- Parameters:
name
- the cache name
-
getApplicationStartedOrder
public int getApplicationStartedOrder()
Description copied from interface:Component
The component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext)
.Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
- Specified by:
getApplicationStartedOrder
in interfaceComponent
- Returns:
- the order, 1000 by default
-
start
public void start(ComponentContext context)
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
startCacheDescriptor
protected void startCacheDescriptor(CacheDescriptor desc)
Creates and starts the cache.
-
stop
public void stop(ComponentContext context) throws InterruptedException
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
- Throws:
InterruptedException
-
maybeStart
protected void maybeStart(String name)
-
getCache
public Cache getCache(String name)
Description copied from interface:CacheService
Gets the cache with the given name.- Specified by:
getCache
in interfaceCacheService
- Parameters:
name
- the cache name- Returns:
- the cache, or
null
if it does not exist
-
getCacheDescriptor
public CacheDescriptor getCacheDescriptor(String descriptor)
- Since:
- 9.3
-
-