AdroitLogic UltraESB v1.7.0

org.adroitlogic.ultraesb.api.mediation
Interface CachingSupport


public interface CachingSupport

Caching support for mediation

Since:
1.7.0

Method Summary
 Cache getDistributedCache()
          Applicable only when the clustering is enabled and deployed as a cluster.
 Cache getDistributedPermanentCache()
          Applicable only when the clustering is enabled and deployed as a cluster.
 Cache getDistributedPersistentCache()
          Applicable only when the clustering is enabled and deployed as a cluster.
 Cache getLocalCache()
          Gets the Cache instance which is available locally in the node, and expires it's entries in a given time.
 Cache getLocalPermanentCache()
          Gets the Cache instance which is available locally in the node, and keeps its contents in the cache within a session.
 Cache getLocalPersistentCache()
          Gets the Cache instance which is available locally in the node, and keeps its contents in the cache forever across the sessions.
 

Method Detail

getLocalCache

Cache getLocalCache()
Gets the Cache instance which is available locally in the node, and expires it's entries in a given time. It also has a time to live and nothing is guaranteed to be present in this cache. If you need your content to be present through out the session, use the CachingSupport.getLocalPermanentCache() to get the cache which will give you the permanent cache.

This cache overflows the content to disk in case of exceeding the in-memory cache size, which defaults to 10000 entries. How ever after storing another 1000 entries in the disk, the cache will permanently overflow, which sniffs something wrong in your mediation, as the content in this cache is automatically cleared in the expiration time.

Returns:
local cache with a expiration time for all the entries in it

getLocalPermanentCache

Cache getLocalPermanentCache()
Gets the Cache instance which is available locally in the node, and keeps its contents in the cache within a session. The contents in this cache will never be expired but they are not persisted, so they will be lost at a System/JVM restart. If you want content to be available across JVM sessions, use CachingSupport.getLocalPersistentCache() instead.

You should be using this with care, as the content life cycle is not managed by the cache it is your responsibility to manage the cache content life cycle. Otherwise you might get into a resource exhaustion. This cache overflows the content to disk in case of exceeding the in-memory cache size, which defaults to 1000 entries, while there is no limit to the content which will be overflowed to disk

Returns:
local cache with a content life time which is equal to the session up time

getLocalPersistentCache

Cache getLocalPersistentCache()
Gets the Cache instance which is available locally in the node, and keeps its contents in the cache forever across the sessions. In other words the content will be persisted to the disk.

Once again you should be extra careful about the usage, as the content will be there even after a system/JVM restart. It is possible to crash the disk space and the data persisted in the disk be lost and the cache is not handling that case as it really cannot do anything for the data corruption. This cache by default keeps only 100 entries in-memory and it off-loads the content to disk and loads the content from disk depending on the demand for those entries.

You could treat this as a NO-SQL persistent store, available locally in your node. If you want the content to be available among the cluster in the case of a clustered deployment, use the CachingSupport.getDistributedPersistentCache()

Returns:
local cache which persists the content into the disk

getDistributedCache

Cache getDistributedCache()
Applicable only when the clustering is enabled and deployed as a cluster. Characteristics of the cache returned by this method is equal to the cache that of CachingSupport.getLocalCache() but this replicates the content across the nodes in the cluster.

Not like the local equivalent to which you can put any thing, this only accepts Serializable content as both key and value of the entries in the cache. This is because the content you put has to be serialized as the cache needs to replicate the content using RMI.

If the node is starting up later in the cluster, (i.e. it joins a cluster with a state) the node bootstraps the cache content from one of its arbitrarily selected peers.

Returns:
distributed cache with a expiration time for all the entries in it

getDistributedPermanentCache

Cache getDistributedPermanentCache()
Applicable only when the clustering is enabled and deployed as a cluster. Characteristics of the cache returned by this method is equal to the cache that of CachingSupport.getLocalPermanentCache() but this replicates the content across the nodes in the cluster.

Not like the local equivalent to which you can put any thing, this only accepts Serializable content as both key and value of the entries in the cache. This is because the content you put has to be serialized as the cache needs to replicate the content using RMI.

You should take extra care about the content life cycle, as the cache doesn't expire the entries that you put. If the node is starting up later in the cluster, (i.e. it joins a cluster with a state) the node bootstraps the cache content from one of its arbitrarily selected peers. Because of the above bootstrap, not like in the local equivalent unless the complete cluster goes off the content will be preserved even on a System/JVM restart on a single node, as it will bootstrap it's cache content from a peer in the cluster.

Returns:
distributed cache with a content life time which is equal to the cluster up time

getDistributedPersistentCache

Cache getDistributedPersistentCache()
Applicable only when the clustering is enabled and deployed as a cluster. Characteristics of the cache returned by this method is equal to the cache that of CachingSupport.getLocalPersistentCache() but this replicates the content across the nodes in the cluster.

Not like the local equivalent to which you can put any thing, this only accepts Serializable content as both key and value of the entries in the cache. This is because the content you put has to be serialized as the cache needs to replicate the content using RMI.

You should take extra care about the content life cycle, as the cache doesn't expire the entries that you put. If the node is starting up later in the cluster, (i.e. it joins a cluster with a state) the node bootstraps the cache content from one of its arbitrarily selected peers.

Returns:
distributed cache which persists the content into the local disk

Copyright (c) 2010-2012 AdroitLogic Private Ltd. All rights reserved.