Deprecated
EHCache uses a net. and a
net..
The net. requires that both keys and values be java..
However the MemoryStore does not and in ehcache-1.2 nonSerializable Objects are permitted. They are discarded
if an attempt it made to overflow them to Disk or to replicate them to remote cache peers.
| Modifier and Type | Field and Description |
|---|---|
| private final Ehcache | |
| private final CacheLockProvider | |
| private static final Logger | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | |
| public final void | clear()
Implements org. |
| public final void | |
| public final Object | Returns: The value placed into the cache with an earlier put, or null if not found or expiredthe key of the element to return. key)Implements org. |
| pack-priv final Ehcache | |
| public final long | Returns: the number of elements in ehcache's MemoryStoreImplements org. |
| public final long | Returns: the number of elements in ehcache's DiskStore. 0 is there is no DiskStoreImplements org. |
| public final String | Returns: the region name of the cache, which is the cache name in ehcacheImplements org. |
| public final long | Returns: the approximate size of memory ehcache is using for the MemoryStore for this cacheImplements org. Warning This method can be very expensive to run. |
| public final int | getTimeout()
Implements org. |
| public final void | lock(Object key)
Implements org. |
| public final long | |
| public final void | put(Object
an Object key key, Object an Object value value)Implements org. |
| public final Object | Returns: the Object, or null if not foundan Object value key)Implements org. |
| public final void | remove(Object
the key of the element to remove key)Implements org. |
| public final Map | Returns: a copy of the cache Elements as a MapImplements org. |
| public final String | Returns: the region name, which is the cache name in ehcacheOverrides java. |
| public final void | unlock(Object key)
Implements org. |
| public final void | update(Object
an Object key key, Object an Object value value)Implements org. |
| cache | back to summary |
|---|---|
| private final Ehcache cache | |
| lockProvider | back to summary |
|---|---|
| private final CacheLockProvider lockProvider | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| SIXTY_THOUSAND_MS | back to summary |
|---|---|
| private static final int SIXTY_THOUSAND_MS | |
| EhCache | back to summary |
|---|---|
| public EhCache(Ehcache cache) Creates a new Hibernate pluggable cache by name. ehcache will look in ehcache.xml to load the configuration for the cache. If the cache is not there, it will use the defaultCache settings. It is always a good idea to specifically configure each cache.
| |
| canLockEntries | back to summary |
|---|---|
public final boolean canLockEntries()
| |
| clear | back to summary |
|---|---|
| public final void clear() throws CacheException Implements org. Remove all elements in the cache, but leave the cache in a useable state. | |
| destroy | back to summary |
|---|---|
| public final void destroy() throws CacheException Implements org. Remove the cache and make it unuseable.
| |
| get | back to summary |
|---|---|
| public final Object get(Object key) throws CacheException Implements org. Gets a value of an element which matches the given key. | |
| getBackingCache | back to summary |
|---|---|
| pack-priv final Ehcache getBackingCache() Package protected method used for testing | |
| getElementCountInMemory | back to summary |
|---|---|
| public final long getElementCountInMemory() Implements org. Doc from org. The count of entries currently contained in the regions in-memory store.
| |
| getElementCountOnDisk | back to summary |
|---|---|
| public final long getElementCountOnDisk() Implements org. Doc from org. The count of entries currently contained in the regions disk store.
| |
| getRegionName | back to summary |
|---|---|
| public final String getRegionName() Implements org. Doc from org. Get the name of the cache region
| |
| getSizeInMemory | back to summary |
|---|---|
| public final long getSizeInMemory() Implements org. Warning This method can be very expensive to run. Allow approximately 1 second per 1MB of entries. Running this method could create liveness problems because the object lock is held for a long period
| |
| getTimeout | back to summary |
|---|---|
| public final int getTimeout() Implements org. Returns the lock timeout for this cache, which is 60s | |
| lock | back to summary |
|---|---|
| public final void lock(Object key) throws CacheException Implements org. Doc from org. If this is a clustered cache, lock the item | |
| nextTimestamp | back to summary |
|---|---|
| public final long nextTimestamp() Implements org. Gets the next timestamp; | |
| put | back to summary |
|---|---|
| public final void put(Object key, Object value) throws CacheException Implements org. Puts an object into the cache.
| |
| read | back to summary |
|---|---|
| public final Object read(Object key) throws CacheException Implements org. Gets an object from the cache. | |
| remove | back to summary |
|---|---|
| public final void remove(Object key) throws CacheException Implements org. Removes the element which matches the key. If no element matches, nothing is removed and no Exception is thrown.
| |
| toMap | back to summary |
|---|---|
| public final Map Implements org. Doc from org. optional operation
| |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| unlock | back to summary |
|---|---|
| public final void unlock(Object key) throws CacheException Implements org. Doc from org. If this is a clustered cache, unlock the item | |
| update | back to summary |
|---|---|
| public final void update(Object key, Object value) throws CacheException Implements org. Updates an object in the cache, or if it does not exist, inserts it.
| |