Oracle® Fusion Middleware .NET API Reference for Oracle Coherence
12c (12.2.1.4.0)
E90869-01
A local in-memory cache implementation.

Namespace: Tangosol.Net.Cache
Assembly: Coherence (in Coherence.dll) Version: 12.2.1.4000 (12.2.1.4000)

Syntax

Remarks

The implementation is thread safe and uses a combination of Most Recently Used (MRU) and Most Frequently Used (MFU) caching strategies.

The cache is size-limited, which means that once it reaches its maximum size ("high-water mark") it prunes itself (to its "low-water mark"). The cache high- and low-water-marks are measured in terms of "units", and each cached item by default uses one unit. All of the cache constructors, except for the default constructor, require the maximum number of units to be passed in. To change the number of units that each cache entry uses, either set the Units property of the cache entry, or extend the ICache implementation so that the inner LocalCache..::..Entry class calculates its own unit size. To determine the current, high-water and low-water sizes of the cache, use the cache object's Units, HighUnits and LowUnits properties. The HighUnits and LowUnits properties can be changed, even after the cache is in use. To specify the LowUnits value as a percentage when constructing the cache, use the extended constructor taking the percentage-prune-level.

Each cached entry never expires by default. To alter this behavior, use a constructor that takes the expiry-millis; for example, an expiry-millis value of 10000 will expire entries after 10 seconds. The ExpiryDelay property can also be set once the cache is in use, but it will not affect the expiry of previously cached items.

The cache can optionally be flushed on a periodic basis by setting the FlushDelay property or scheduling a specific flush time by setting the FlushTime property.

Cache hit statistics can be obtained from the CacheHits, CacheMisses and HitProbability read-only properties. The statistics can be reset by invoking ResetHitStatistics()()()(). The statistics are automatically reset when the cache is cleared (the Clear()()()() method).

The LocalCache implements the IObservableCache interface, meaning it provides event notifications to any interested listener for each insert, update and delete, including those that occur when the cache is pruned or entries are automatically expired.

This implementation is designed to support extension through inheritence. To override the one-unit-per-entry default behavior, extend the inner Entry class and override the CalculateUnits(Object) method.

Inheritance Hierarchy

See Also