Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.net.cache
Interface ConfigurableCacheMap

All Superinterfaces:
  CacheMap, java.util.Map, ObservableMap

All Known Implementing Classes:
  LocalCache, ObservableSplittingBackingCache, OldCache, SerializationCache

    public interface ConfigurableCacheMap

extends CacheMap

An extension to the CacheMap interface that supports runtime configuration and monitoring of various caching properties.

Since:
  Coherence 3.5
Author:
  cp 2009-01-13

Nested Class Summary
`static interface` | `ConfigurableCacheMap.Entry` A cache Entry carries information additional to the base Map Entry in order to support eviction and expiry.
`static interface` | `ConfigurableCacheMap.EvictionPolicy` An eviction policy is an object that the cache provides with access information, and when requested, the eviction policy selects and evicts entries from the cache.
`static interface` | `ConfigurableCacheMap.UnitCalculator` A unit calculator is an object that can calculate the cost of caching an object.

Field Summary

Fields inherited from interface com.tangosol.net.cache.CacheMap
`EXPIRY_DEFAULT, EXPIRY_NEVER`

Method Summary
`void` | `evict()` Evict all entries from the cache that are no longer valid, and potentially prune the cache size if the cache is size-limited and its size is above the caching low water mark.
`void` | `evict(java.lang.Object oKey)` Evict a specified key from the cache, as if it had expired from the cache.
`void` | `evictAll(java.util.Collection colKeys)` Evict the specified keys from the cache, as if they had each expired from the cache.
`ConfigurableCacheMap.Entry` | `getCacheEntry(java.lang.Object oKey)` Locate a cache Entry in the cache based on its key.
`ConfigurableCacheMap.EvictionPolicy` | `getEvictionPolicy()` Obtain the current EvictionPolicy used by the cache.
`int` | `getExpiryDelay()` Determine the default "time to live" for each individual cache entry.
`int` | `getFlushDelay()` Determine the delay between cache flushes.
`int` | `getHighUnits()` Determine the limit of the cache size in units.
`int` | `getLowUnits()` Determine the point to which the cache will shrink when it prunes.
`ConfigurableCacheMap.UnitCalculator` | `getUnitCalculator()` Obtain the current UnitCalculator used by the cache.
`int` | `getUnitFactor()` Determine the factor by which the Units, LowUnits and HighUnits properties are adjusted.
`int` | `getUnits()` Determine the number of units that the cache currently stores.
`void` | `setEvictionPolicy(ConfigurableCacheMap.EvictionPolicy policy)` Set the EvictionPolicy for the cache to use.
`void` | `setExpiryDelay(int cMillis)` Specify the default "time to live" for cache entries.
`void` | `setFlushDelay(int cMillis)` Specify the delay between cache flushes.
`void` | `setHighUnits(int cMax)` Update the maximum size of the cache in units.
`void` | `setLowUnits(int cUnits)` Specify the point to which the cache will shrink when it prunes.
`void` | `setUnitCalculator(ConfigurableCacheMap.UnitCalculator calculator)` Set the UnitCalculator for the cache to use.
`void` | `setUnitFactor(int nFactor)` Determine the factor by which the Units, LowUnits and HighUnits properties are adjusted.

Methods inherited from interface com.tangosol.net.cache.CacheMap
`getAll, put, put`

Methods inherited from interface com.tangosol.util.ObservableMap
`addMapListener, addMapListener, addMapListener, removeMapListener, removeMapListener, removeMapListener`

Methods inherited from interface java.util.Map
`clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values`

Method Detail

### getUnits

    int getUnits()

  Determine the number of units that the cache currently stores.

  Note: It is expected that the return type will be widened to a `long` in Coherence 4.

  Returns:
    the current size of the cache in units

### getHighUnits

    int getHighUnits()

  Determine the limit of the cache size in units. The cache will prune itself automatically once it reaches its maximum unit level. This is often referred to as the "high water mark" of the cache.

  Note: It is expected that the return type will be widened to a `long` in Coherence 4.

  Returns:
    the limit of the cache size in units

### setHighUnits

    void setHighUnits(int cMax)

  Update the maximum size of the cache in units. This is often referred to as the "high water mark" of the cache.

  Note: It is expected that the parameter will be widened to a `long` in Coherence 4.

  Parameters:
    `cMax` - the new maximum size of the cache, in units

### getLowUnits

    int getLowUnits()

  Determine the point to which the cache will shrink when it prunes. This is often referred to as a "low water mark" of the cache. If the cache incrementally prunes, then this setting will have no effect.

  Note: It is expected that the parameter will be widened to a `long` in Coherence 4.

  Returns:
    the number of units that the cache prunes to

### setLowUnits

    void setLowUnits(int cUnits)

  Specify the point to which the cache will shrink when it prunes. This is often referred to as a "low water mark" of the cache.

  Note: It is expected that the parameter will be widened to a `long` in Coherence 4.

  Parameters:
    `cUnits` - the number of units that the cache prunes to

### getUnitFactor

    int getUnitFactor()

  Determine the factor by which the Units, LowUnits and HighUnits properties are adjusted. Using a binary unit calculator, for example, the factor `1048576` could be used to count megabytes instead of bytes.

  Note: This property exists only to avoid changing the type of the units, low units and high units properties from 32-bit values to 64-bit values. It is expected that the parameter will be dropped in Coherence 4.

  Returns:
    the units factor; the default is 1

### setUnitFactor

    void setUnitFactor(int nFactor)

  Determine the factor by which the Units, LowUnits and HighUnits properties are adjusted. Using a binary unit calculator, for example, the factor `1048576` could be used to count megabytes instead of bytes.

  Note: This property exists only to avoid changing the type of the units, low units and high units properties from 32-bit values to 64-bit values. It is expected that the parameter will be dropped in Coherence 4.

  Parameters:
    `nFactor` - the units factor; the default is 1

### evict

    void evict(java.lang.Object oKey)

  Evict a specified key from the cache, as if it had expired from the cache. If the key is not in the cache, then the method has no effect.

  Parameters:
    `oKey` - the key to evict from the cache

### evictAll

    void evictAll(java.util.Collection colKeys)

  Evict the specified keys from the cache, as if they had each expired from the cache.

  The result of this method is defined to be semantically the same as the following implementation:

       for (Iterator iter = colKeys.iterator(); iter.hasNext(); )
           {
           Object oKey = iter.next();
           evict(oKey);
           }

  Parameters:
    `colKeys` - a collection of keys to evict from the cache

### evict

    void evict()

  Evict all entries from the cache that are no longer valid, and potentially prune the cache size if the cache is size-limited and its size is above the caching low water mark.

### getExpiryDelay

    int getExpiryDelay()

  Determine the default "time to live" for each individual cache entry.

  Returns:
    the number of milliseconds that a cache entry value will live, or zero if cache entries are never automatically expired

### setExpiryDelay

    void setExpiryDelay(int cMillis)

  Specify the default "time to live" for cache entries. This does not affect the already-scheduled expiry of existing entries.

  Parameters:
    `cMillis` - the number of milliseconds that cache entries will live, or zero to disable automatic expiry

### getFlushDelay

    int getFlushDelay()

  Determine the delay between cache flushes. A cache flush evicts entries that have expired.

  This value is used by cache implementations that periodically evict entries that have expired; this value has no meaning for cache implementations that aggressively evict entries as they expire.

  Returns:
    the number of milliseconds between cache flushes, or zero which signifies that the cache never flushes

### setFlushDelay

    void setFlushDelay(int cMillis)

  Specify the delay between cache flushes. A cache flush evicts entries that have expired.

  This value is used by cache implementations that periodically evict entries that have expired; this value has no meaning for cache implementations that aggressively evict entries as they expire.

  Parameters:
    `cMillis` - the number of milliseconds between cache flushes, or zero to never flush

### getCacheEntry

    ConfigurableCacheMap.Entry getCacheEntry(java.lang.Object oKey)

  Locate a cache Entry in the cache based on its key.

  Parameters:
    `oKey` - the key object to search for
  Returns:
    the Entry or null

### getEvictionPolicy

    ConfigurableCacheMap.EvictionPolicy getEvictionPolicy()

  Obtain the current EvictionPolicy used by the cache.

  Returns:
    the EvictionPolicy used by the cache

### setEvictionPolicy

    void setEvictionPolicy(ConfigurableCacheMap.EvictionPolicy policy)

  Set the EvictionPolicy for the cache to use.

  Parameters:
    `policy` - an EvictionPolicy

### getUnitCalculator

    ConfigurableCacheMap.UnitCalculator getUnitCalculator()

  Obtain the current UnitCalculator used by the cache.

  Returns:
    the UnitCalculator used by the cache

### setUnitCalculator

    void setUnitCalculator(ConfigurableCacheMap.UnitCalculator calculator)

  Set the UnitCalculator for the cache to use.

  Parameters:
    `calculator` - a UnitCalculator

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.