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.coherence.weblogic
Class PortalCacheProvider.ReloadableCacheImpl

    java.lang.Object
      com.tangosol.coherence.weblogic.PortalCacheProvider.CacheImpl
          com.tangosol.coherence.weblogic.PortalCacheProvider.ReloadableCacheImpl

All Implemented Interfaces:
  com.bea.p13n.cache.Cache, com.bea.p13n.cache.CacheDefaults, com.bea.p13n.cache.CacheStats, com.bea.p13n.cache.ReloadableCache

Enclosing class:
  PortalCacheProvider

    protected class PortalCacheProvider.ReloadableCacheImpl

extends PortalCacheProvider.CacheImpl

CacheImpl extension that supports the ReloadableCache interface.

Nested Class Summary
`protected class` | `PortalCacheProvider.ReloadableCacheImpl.ReloadableEntryInfo` An EntryInfo extension that contains additional metadata about a cached Map.Entry that can be refreshed using a CacheReloader.

Nested classes/interfaces inherited from class com.tangosol.coherence.weblogic.PortalCacheProvider.CacheImpl
`PortalCacheProvider.CacheImpl.EntryInfo`

Field Summary

Fields inherited from class com.tangosol.coherence.weblogic.PortalCacheProvider.CacheImpl
`m_cache, m_cacheLocal, m_fEnabled, m_mapEntryInfo, m_setLocalClass, m_sName`

Fields inherited from interface com.bea.p13n.cache.CacheDefaults
`DEFAULT_ENABLED, DEFAULT_MAX_ENTRIES, DEFAULT_TTL, MAX_ENTRIES_MAX, TTL_NEVER_EXPIRE`

Constructor Summary
`protected` | `PortalCacheProvider.ReloadableCacheImpl(java.lang.String sName, NamedCache cache)` Create a new CacheImpl.

Method Summary
`protected boolean` | `compactEntryInfoMap(java.util.Map map, java.lang.Object oKey, PortalCacheProvider.CacheImpl.EntryInfo info)` Remove the given EntryInfo from the specified Map if it is safe to do so.
`java.lang.Object` | `get(java.lang.Object oKey)` Return the cached value associated with the given key.
`com.bea.p13n.cache.CacheReloader` | `getReloader(java.lang.Object oKey)` Return the CacheReloader used for the given key or null if no CacheReloader is currently set.
`protected PortalCacheProvider.CacheImpl.EntryInfo` | `instantiateEntryInfo(boolean fLocal)` Factory pattern: Create a new EntryInfo.
`protected PortalCacheProvider.ReloadableCacheImpl.ReloadableEntryInfo` | `instantiateReloadableEntryInfo(boolean fLocal, com.bea.p13n.cache.CacheReloader reloader, long cMillis)` Factory pattern: Create a new ReloadableEntryInfo.
`java.lang.Object` | `put(java.lang.Object oKey, java.lang.Object oValue, long cMillis)` Cache the given value with the specified time-to-live.
`java.lang.Object` | `put(java.lang.Object oKey, java.lang.Object oValue, long cMillis, com.bea.p13n.cache.CacheReloader reloader)` Cache the given value with a specific time-to-live and specify a CacheReloader used to reload the value when that time-to-live expires.
`void` | `reload(java.lang.Object oKey)` Run the CacheReloader associated with the given key to refresh the value in the cache.
`protected java.lang.Object` | `reload(java.lang.Object oKey, java.lang.Object oValueOld, PortalCacheProvider.ReloadableCacheImpl.ReloadableEntryInfo info)` Reload the value for the given key using the CacheReloader associated with the specified EntryInfo and place the new value into the delegate NamedCache.
`void` | `setReloader(java.lang.Object oKey, com.bea.p13n.cache.CacheReloader reloader)` Set the CacheReloader to be run when a cached object has expired.
`com.bea.p13n.cache.CacheReloader` | `unsetReloader(java.lang.Object oKey)` Remove the CacheReloader used for the given key.

Methods inherited from class com.tangosol.coherence.weblogic.PortalCacheProvider.CacheImpl
`clear, containsKey, ensureLocalCache, entrySet, flush, flush, getCacheProvider, getDescription, getEntryInfoMap, getHitCount, getHitRate, getLocalCache, getLocalClassSet, getMaxEntries, getMissCount, getName, getNamedCache, getTtl, instantiateEntryInfoMap, instantiateLocalCache, isEnabled, keySet, put, put, put, release, remove, resetStats, setEnabled, setMaxEntries, setTtl, size, toString`

Constructor Detail

### PortalCacheProvider.ReloadableCacheImpl

    protected PortalCacheProvider.ReloadableCacheImpl(java.lang.String sName,
                                                      NamedCache cache)

  Create a new CacheImpl.

  Parameters:
    `sName` - the name of the Cache; must not be null
    `cache` - the delegate NamedCache; must not be null

Method Detail

### getReloader

    public com.bea.p13n.cache.CacheReloader getReloader(java.lang.Object oKey)

  Return the CacheReloader used for the given key or null if no CacheReloader is currently set.

  This method has no effect if the Cache is disabled (null is returned).

  Specified by:
    `getReloader` in interface `com.bea.p13n.cache.ReloadableCache`
  Overrides:
    `getReloader` in class `PortalCacheProvider.CacheImpl`
  Parameters:
    `oKey` - the target key
  Returns:
    the CacheReloader used to reload the cache value for the given key when the value expires or null if a CacheReloader has not been set for the given key

### setReloader

    public void setReloader(java.lang.Object oKey,
                            com.bea.p13n.cache.CacheReloader reloader)

  Set the CacheReloader to be run when a cached object has expired.

  When `get()` is called with the specified key and the entry has expired, the given CacheReloader is used to reload the object and refresh the Cache. Requests for cached objects without an associated CacheReloader will return null in this situation.

  This method has no effect if the Cache is disabled.

  Specified by:
    `setReloader` in interface `com.bea.p13n.cache.ReloadableCache`
  Overrides:
    `setReloader` in class `PortalCacheProvider.CacheImpl`
  Parameters:
    `oKey` - the key to add (or replace) the CacheReloader for
    `reloader` - the new CacheReloader (or null to remove the current CacheReloader)

### unsetReloader

    public com.bea.p13n.cache.CacheReloader unsetReloader(java.lang.Object oKey)

  Remove the CacheReloader used for the given key.

  This method has no effect if the Cache is disabled (null is returned).

  Specified by:
    `unsetReloader` in interface `com.bea.p13n.cache.ReloadableCache`
  Overrides:
    `unsetReloader` in class `PortalCacheProvider.CacheImpl`
  Parameters:
    `oKey` - the target key
  Returns:
    the removed CacheReloader or null if no CacheReloader was currently set

### put

    public java.lang.Object put(java.lang.Object oKey,
                                java.lang.Object oValue,
                                long cMillis,
                                com.bea.p13n.cache.CacheReloader reloader)

  Cache the given value with a specific time-to-live and specify a CacheReloader used to reload the value when that time-to-live expires.

  Neither the key nor the value may be null. The reloader may be null (in which case no CacheReloader is used and the value will expire in the "normal" way.)

  Specified by:
    `put` in interface `com.bea.p13n.cache.ReloadableCache`
  Overrides:
    `put` in class `PortalCacheProvider.CacheImpl`
  Parameters:
    `oKey` - key with which the specified value is to be cached; must not be null
    `oValue` - value to cache; must not be null
    `cMillis` - the time-to-live, in milliseconds, of the cached object; this TTL overrides the default TTL for the Cache, and applies only to the given key
    `reloader` - the CacheReloader to associate with the given key
  Returns:
    the previously cached value for the given key

### reload

    public void reload(java.lang.Object oKey)

  Run the CacheReloader associated with the given key to refresh the value in the cache. This method blocks until the object is reloaded.

  This method has no effect if the Cache is disabled.

  Specified by:
    `reload` in interface `com.bea.p13n.cache.ReloadableCache`
  Overrides:
    `reload` in class `PortalCacheProvider.CacheImpl`
  Parameters:
    `oKey` - the target key

### put

    public java.lang.Object put(java.lang.Object oKey,
                                java.lang.Object oValue,
                                long cMillis)

  Cache the given value with the specified time-to-live.

  This method has no effect if the Cache is disabled (null is returned).

  Specified by:
    `put` in interface `com.bea.p13n.cache.Cache`
  Overrides:
    `put` in class `PortalCacheProvider.CacheImpl`
  Parameters:
    `oKey` - the key of the entry to create; must not be null
    `oValue` - the value to associate with the key; must not be null
    `cMillis` - the time-to-live, in milliseconds, of the cached object; this TTL overrides the default TTL for the Cache, and applies only to the given key
  Returns:
    the previous value associated with the given key

### get

    public java.lang.Object get(java.lang.Object oKey)

  Return the cached value associated with the given key.

  This method has no effect if the Cache is disabled (null is returned).

  Specified by:
    `get` in interface `com.bea.p13n.cache.Cache`
  Overrides:
    `get` in class `PortalCacheProvider.CacheImpl`
  Parameters:
    `oKey` - the target key; must not be null
  Returns:
    the cache value associated with the given key or null if no such mapping exists or has expired

### reload

    protected java.lang.Object reload(java.lang.Object oKey,
                                      java.lang.Object oValueOld,
                                      PortalCacheProvider.ReloadableCacheImpl.ReloadableEntryInfo info)

  Reload the value for the given key using the CacheReloader associated with the specified EntryInfo and place the new value into the delegate NamedCache.

  This method is not thread safe.

  Parameters:
    `oKey` - the key to reload
    `oValueOld` - the old cached value; may be null
    `info` - the EntryInfo for the given key
  Returns:
    the newly reloaded value

### compactEntryInfoMap

    protected boolean compactEntryInfoMap(java.util.Map map,
                                          java.lang.Object oKey,
                                          PortalCacheProvider.CacheImpl.EntryInfo info)

  Remove the given EntryInfo from the specified Map if it is safe to do so.

  This method is not thread safe.

  Overrides:
    `compactEntryInfoMap` in class `PortalCacheProvider.CacheImpl`
  Parameters:
    `map` - the Map that contains the EntryInfo
    `oKey` - the key used to store the EntryInfo in the given Map
    `info` - the candidate EntryInfo
  Returns:
    true if the EntryInfo was removed from the Map; false otherwise

### instantiateEntryInfo

    protected PortalCacheProvider.CacheImpl.EntryInfo instantiateEntryInfo(boolean fLocal)

  Factory pattern: Create a new EntryInfo.

  Overrides:
    `instantiateEntryInfo` in class `PortalCacheProvider.CacheImpl`
  Parameters:
    `fLocal` - if true, the corresponding Map.Entry is stored in the local Map
  Returns:
    a new EntryInfo

### instantiateReloadableEntryInfo

    protected PortalCacheProvider.ReloadableCacheImpl.ReloadableEntryInfo instantiateReloadableEntryInfo(boolean fLocal,
                                                                                                         com.bea.p13n.cache.CacheReloader reloader,
                                                                                                         long cMillis)

  Factory pattern: Create a new ReloadableEntryInfo.

  Parameters:
    `fLocal` - if true, the corresponding Map.Entry is stored in the local Map
    `reloader` - the CacheReloader that should be used to reload the corresponding Map.Entry value
    `cMillis` - the TTL of the corresponding Map.Entry
  Returns:
    a new EntryInfo

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.