Class VersionedNearCache

All Implemented Interfaces:
ClassLoaderAware, CacheMap, NamedCache, NamedCollection, NamedMap, Releasable, ConcurrentMap, InvocableMap, ObservableMap, QueryMap, AutoCloseable, Map

public class VersionedNearCache extends NearCache
Deprecated.
as of Coherence 3.2 all the functionality of this class has been superceded by the NearCache implementation
A near cache that fronts a Distributed Cache and uses a Replicated Cache of version data to keep the local cache in sync.
Author:
cp 2002.10.20
  • Constructor Details

    • VersionedNearCache

      public VersionedNearCache(Map mapLocal, NamedCache mapDist, NamedCache mapVersion)
      Deprecated.
      Construct a VersionedNearCache.
      Parameters:
      mapLocal - local cache to front the distributed cache with
      mapDist - distributed cache of Versionable objects
      mapVersion - replicated version cache
  • Method Details

    • release

      public void release()
      Deprecated.
      Invalidate the CachingMap. If the BackMap implements an ObservableMap calling this method is necessary to remove the BackMap listener.
      Specified by:
      release in interface Releasable
      Overrides:
      release in class NearCache
    • get

      public Object get(Object oKey)
      Deprecated.
      Returns the value to which this map maps the specified key.
      Specified by:
      get in interface ConcurrentMap
      Specified by:
      get in interface Map
      Overrides:
      get in class CachingMap
      Parameters:
      oKey - the key object
      Returns:
      the value to which this map maps the specified key, or null if the map contains no mapping for this key
      See Also:
    • getAll

      public Map getAll(Collection colKeys)
      Deprecated.
      Get all the specified keys, if they are in the cache. For each key that is in the cache, that key and its corresponding value will be placed in the map that is returned by this method. The absence of a key in the returned map indicates that it was not in the cache, which may imply (for caches that can load behind the scenes) that the requested data could not be loaded.

      Note: this implementation does not differentiate between missing keys or null values stored in the back map; in both cases the returned map will not contain the corresponding entry.

      Specified by:
      getAll in interface CacheMap
      Specified by:
      getAll in interface NamedMap
      Overrides:
      getAll in class CachingMap
      Parameters:
      colKeys - a collection of keys that may be in the named cache
      Returns:
      a Map of keys to values for the specified keys passed in col
      Since:
      Coherence 2.5
    • remove

      public Object remove(Object oKey)
      Deprecated.
      Removes the mapping for this key from this map if present. Expensive: updates both the underlying cache and the local cache.
      Specified by:
      remove in interface ConcurrentMap
      Specified by:
      remove in interface Map
      Overrides:
      remove in class CachingMap
      Parameters:
      oKey - key whose mapping is to be removed from the map
      Returns:
      previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values.
    • put

      public Object put(Object oKey, Object oValue, boolean fReturn, long cMillis)
      Deprecated.
      Implementation of put method that optionally skips the return value retrieval and allows to specify an expiry for the cache entry.
      Overrides:
      put in class CachingMap
      Parameters:
      oKey - the key
      oValue - the value
      fReturn - if true, the return value is required; otherwise the return value will be ignored
      cMillis - the number of milliseconds until the cache entry will expire
      Returns:
      previous value (if required)
      Throws:
      UnsupportedOperationException - if the requested expiry is a positive value and either the front map or the back map implementations do not support the expiration functionality
      See Also:
    • putAll

      public void putAll(Map map)
      Deprecated.
      Copy all of the mappings from the specified map to this map.
      Specified by:
      putAll in interface ConcurrentMap
      Specified by:
      putAll in interface Map
      Overrides:
      putAll in class CachingMap
      Parameters:
      map - mappings to be stored in this map
    • updateVersion

      protected void updateVersion(Object oKey, Object oValue)
      Deprecated.
      Update value's version in the version cache.
      Parameters:
      oKey - the key
      oValue - the value
    • incrementVersion

      protected void incrementVersion(Object oKey, Object oValue)
      Deprecated.
      Increment value's version.
      Parameters:
      oKey - the key
      oValue - the value
    • lock

      public boolean lock(Object oKey, long lMillis)
      Deprecated.
      Attempt to lock the specified item within the specified period of time. Expensive: Locking always occurs on the back cache, and removes the value from the front cache if successful (forcing a get() from the back cache on next access to the key).
      Specified by:
      lock in interface ConcurrentMap
      Overrides:
      lock in class NearCache
      Parameters:
      oKey - key being locked
      lMillis - the number of milliseconds to continue trying to obtain a lock; pass zero to return immediately; pass -1 to block the calling thread until the lock could be obtained
      Returns:
      true if the item was successfully locked within the specified time; false otherwise
    • unlock

      public boolean unlock(Object oKey)
      Deprecated.
      Unlock the specified item.
      Specified by:
      unlock in interface ConcurrentMap
      Overrides:
      unlock in class NearCache
      Parameters:
      oKey - key being unlocked
      Returns:
      true if the item was successfully unlocked; false otherwise
    • instantiateVersionCacheListener

      protected MapListener instantiateVersionCacheListener()
      Deprecated.
      Factory method: Provide a MapListener that listens to the VersionCache and invalidates local entries accordingly.
      Returns:
      a MapListener object to listen to the VersionCache
    • getVersionCache

      public NamedCache getVersionCache()
      Deprecated.
      Obtain the NamedCache object that holds the version data.
      Returns:
      the NamedCache object, which holds just keys and version data