Caching
The OSC leverages two kinds of caching during execution: a local cache and a distributed cache. Both caches operate through the same interface, but are semantically different. The local cache supports non-serializable objects, whereas the distributed cache does not.
By default, the OSC uses a local LRU cache and Coherence as a distributed cache. If Coherence support is not desired, then the LRU cache can be substituted for the distributed cache as well.
Configuring Coherence
The Coherence configuration for OSC needs to be merged with the configuration for OIPA. You can do this by adding the following to the coherence-cache-config.xml file.
Coherence Configuration for OSC
Note: This configuration can be further adjusted to meet a deployment's specific needs.
<!-- Map Templates to Distributed Near Scheme --> <caching-scheme-mapping> <cache-mapping> <cache-name>OSC_Templates</cache-name> <scheme-name>OSCScheme</scheme-name> </cache-mapping> </caching-scheme-mapping> <!-- OSC Distributed In-memory Cache --> <caching-schemes> <local-scheme> <scheme-name>SampleMemoryScheme</scheme-name> </local-scheme> <distributed-scheme> <scheme-name>OSCScheme</scheme-name> <backing-map-scheme> <local-scheme> <scheme-ref>SampleMemoryScheme</scheme-ref> </local-scheme> </backing-map-scheme> </distributed-scheme> </caching-schemes> |
Configuring the LRU Cache
The LRU cache is a simple, built-in solution for caching non-serializable objects. It is configured entirely through the osc.properties file.
Property Name | Value Type | Default | Notes |
---|---|---|---|
cache.lru.<cache_name>.initSize | Integer | 100 | For a given LRU sub-cache, specify the initial size |
cache.lru.<cache_name>.maxSize | Integer | 1000 | For a given LRU sub-cache, specify the maximum size. |
Note: Here, the <cache_name> is the internal sub-cache ID (currently only OSCJMS and OSC_Templates).
Disabling the Cache
One or both of the caches can be disabled by overriding the default cache implementation. A special no-op cache has been provided, which stops the cache from using any data.
To change to the no-op cache, set cache.distributed.type or cache.local.type to com.oi.osc.cache.NoCache.