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 classCacheServiceImpl.AbstractCachePubSubInvalidatorstatic classCacheServiceImpl.CacheInvalidationprotected classCacheServiceImpl.CachePubSubInvalidator
-
Field Summary
Fields Modifier and Type Field Description static StringCACHE_INVAL_PUBSUB_TOPICprotected Map<String,CacheManagement>cachesCurrently registered caches.static StringDEFAULT_CACHE_IDprotected CacheServiceImpl.CachePubSubInvalidatorinvalidatorprotected booleanstartedstatic StringXP_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 intgetApplicationStartedOrder()The component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext).CachegetCache(String name)Gets the cache with the given name.CacheDescriptorgetCacheDescriptor(String descriptor)protected voidmaybeStart(String name)voidregisterCache(String name)Programmatically registers a cache with the given name, with the the size and the timeout given by the default cache.voidregisterCache(String name, int maxSize, int timeout)Deprecated.voidstart(ComponentContext context)Start the component.protected voidstartCacheDescriptor(CacheDescriptor desc)Creates and starts the cache.voidstop(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
-
-
Method Detail
-
registerCache
@Deprecated public void registerCache(String name, int maxSize, int timeout)
Deprecated.Description copied from interface:CacheServiceProgrammatically registers a cache with the given characteristics.- Specified by:
registerCachein 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:CacheServiceProgrammatically registers a cache with the given name, with the the size and the timeout given by the default cache.- Specified by:
registerCachein interfaceCacheService- Parameters:
name- the cache name
-
getApplicationStartedOrder
public int getApplicationStartedOrder()
Description copied from interface:ComponentThe 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:
getApplicationStartedOrderin interfaceComponent- Returns:
- the order, 1000 by default
-
start
public void start(ComponentContext context)
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
startCacheDescriptor
protected void startCacheDescriptor(CacheDescriptor desc)
Creates and starts the cache.
-
stop
public void stop(ComponentContext context) throws InterruptedException
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent- Throws:
InterruptedException
-
maybeStart
protected void maybeStart(String name)
-
getCache
public Cache getCache(String name)
Description copied from interface:CacheServiceGets the cache with the given name.- Specified by:
getCachein interfaceCacheService- Parameters:
name- the cache name- Returns:
- the cache, or
nullif it does not exist
-
getCacheDescriptor
public CacheDescriptor getCacheDescriptor(String descriptor)
- Since:
- 9.3
-
-