T
- the class of the data stored in the cache.public abstract class AbstractCache<T> extends Object implements Cache<T>
Cache
implementations. It provides events DisposableCacheValue
management.Modifier and Type | Field and Description |
---|---|
protected EventListenerList |
cacheEntryListeners
The list of listener to called when events appends on a cache entry.
|
protected CacheConfiguration |
configuration
The configuration used to create the cache.
|
Constructor and Description |
---|
AbstractCache()
Deprecated.
since 8.3RC1, use
AbstractCache(CacheConfiguration) instead |
AbstractCache(CacheConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
void |
addCacheEntryListener(CacheEntryListener<T> listener)
Add the provided listener to the cache to catch events on entries like add, remove etc.
|
void |
dispose()
Release all the resources this cache use.
|
protected void |
disposeCacheValue(T value)
Dispose the value being removed from the cache.
|
void |
removeCacheEntryListener(CacheEntryListener<T> listener)
Remove the provided listener from the list of listeners.
|
protected void |
sendEntryAddedEvent(CacheEntryEvent<T> event)
Helper method to send event when a new cache entry is inserted.
|
protected void |
sendEntryModifiedEvent(CacheEntryEvent<T> event)
Helper method to send event when a cache entry is modified.
|
protected void |
sendEntryRemovedEvent(CacheEntryEvent<T> event)
Helper method to send event when an existing cache entry is removed.
|
protected final CacheConfiguration configuration
protected final EventListenerList cacheEntryListeners
@Deprecated public AbstractCache()
AbstractCache(CacheConfiguration)
insteadpublic AbstractCache(CacheConfiguration configuration)
configuration
- the configuration of the cachepublic void dispose()
Cache
public void addCacheEntryListener(CacheEntryListener<T> listener)
Cache
addCacheEntryListener
in interface Cache<T>
listener
- the implemented listener.public void removeCacheEntryListener(CacheEntryListener<T> listener)
Cache
removeCacheEntryListener
in interface Cache<T>
listener
- the implemented listener.protected void sendEntryAddedEvent(CacheEntryEvent<T> event)
event
- the event to send.protected void sendEntryRemovedEvent(CacheEntryEvent<T> event)
event
- the event to send.protected void sendEntryModifiedEvent(CacheEntryEvent<T> event)
event
- the event to send.protected void disposeCacheValue(T value)
value
- the value to disposeCopyright © 2004–2022 XWiki. All rights reserved.