Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.2.4 generated on January 7 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## kodo.datacache
Class CacheImpl

    java.lang.Object
      |
      +--kodo.datacache.AbstractCacheImpl
            |
            +--kodo.datacache.CacheImpl

All Implemented Interfaces:
  com.solarmetric.util.Closeable, Configurable, DataCache, RemoteCommitListener

public class CacheImpl
extends AbstractCacheImpl
implements RemoteCommitListener

A PersistenceManagerFactory cache implementation. Batch updates are performed atomically.

Fields inherited from class kodo.datacache.AbstractCacheImpl
`cache, conf, log`

Fields inherited from interface kodo.datacache.DataCache
`DEFAULT_NAME`

Constructor Summary
`CacheImpl()`

Method Summary
`protected boolean` | `addExistingUpdates()` Do nothing with the existing updates.
`void` | `afterCommit(RemoteCommitEvent event)` Notification that a transaction associated with a different PersistenceManagerFactory has successfully committed.
`void` | `clear()` Remove all data from this cache.
`void` | `close()` Close any resources used by this listener.
`void` | `endConfiguration()` Invoked upon completion of bean property configuration for this object.
`CacheMap` | `getCacheMap()` Returns the underlying `CacheMap` that this `CacheImpl` is using.
`int` | `getCacheSize()` Returns the maximum number of unpinned objects to keep hard references to.
`int` | `getSoftReferenceSize()` Returns the maximum number of unpinned objects to keep soft references to.
`protected Map` | `newMap()` Returns a new `CacheMap` for use as the underlying data cache.
`boolean` | `pin(Object key)` Pin the value stored under `oid` into the cache.
`void` | `setCacheSize(int size)` Sets the maximum number of unpinned objects to keep hard references to.
`void` | `setSoftReferenceSize(int size)` Sets the maximum number of unpinned objects to keep soft references to.
`boolean` | `unpin(Object key)` Unpin the value stored under `oid` into the cache.

Methods inherited from class kodo.datacache.AbstractCacheImpl
`batchUpdate, containsKey, get, getCacheStatisticsString, getHitCount, getMap, getMissCount, getName, getRecordCacheStatistics, getStatistics, keyRemoved, put, registerListener, remove, removeAll, removeListener, setConfiguration, setName, setRecordCacheStatistics, startConfiguration, toString, updateValue`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CacheImpl

    public CacheImpl()

Method Detail

### getCacheMap

    public CacheMap getCacheMap()

  Returns the underlying `CacheMap` that this `CacheImpl` is using. This is not an unmodifiable view on the map, so care should be taken with this reference. Implementations should probably not mess with the contents of the cache, but should only use this reference to obtain cache metrics.

### setCacheSize

    public void setCacheSize(int size)

  Sets the maximum number of unpinned objects to keep hard references to. If the map contains more unpinned objects than `size`, then this method will result in the cache flushing old values.

### getCacheSize

    public int getCacheSize()

  Returns the maximum number of unpinned objects to keep hard references to.

### setSoftReferenceSize

    public void setSoftReferenceSize(int size)

  Sets the maximum number of unpinned objects to keep soft references to. If the map contains more soft references than `size`, then this method will result in the cache flushing values.

### getSoftReferenceSize

    public int getSoftReferenceSize()

  Returns the maximum number of unpinned objects to keep soft references to. Defaults to `-1`.

### newMap

    protected Map newMap()

  Returns a new `CacheMap` for use as the underlying data cache. This implementation returns a `CacheMap`. To implement a more sophisticated caching strategy, override this method to return a subclass of `CacheMap`.
  Overrides:
    `newMap` in class `AbstractCacheImpl`

### addExistingUpdates

    protected boolean addExistingUpdates()

  Do nothing with the existing updates. This relies on the fact that any existing PCDatas are objects retrieved by invoking get() on this object in an atomic (synchronized) fashion.
  Overrides:
    `addExistingUpdates` in class `AbstractCacheImpl`

### pin

    public boolean pin(Object key)

  Description copied from interface: `DataCache`
  Pin the value stored under `oid` into the cache. This method guarantees that `oid`'s value will not be dropped by the caching algorithm. This method does not affect the behavior of `DataCache.remove(java.lang.Object)`.
  Following copied from interface: `kodo.datacache.DataCache`
  Returns:
    `true` if `oid`'s value was pinned into the cache; `false` if the oid is not in the cache.

### unpin

    public boolean unpin(Object key)

  Description copied from interface: `DataCache`
  Unpin the value stored under `oid` into the cache. This method reverses a previous invocation of `DataCache.pin(java.lang.Object)`. This method does not remove anything from the cache; it merely makes `oid`'s value a candidate for flushing from the cache.
  Following copied from interface: `kodo.datacache.DataCache`
  Returns:
    `true` if `oid`'s value was unpinned from the cache; `false` if the oid is not in the cache.

### clear

    public void clear()

  Description copied from interface: `DataCache`
  Remove all data from this cache. This does not result in an update of other caches. Rather, it should only be used for clearing the cache. Meaningful changes to the state of the cache should be made via the `DataCache.batchUpdate(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection)` method.
  Overrides:
    `clear` in class `AbstractCacheImpl`

### close

    public void close()

  Description copied from interface: `RemoteCommitListener`
  Close any resources used by this listener.
  Specified by:
    `close` in interface `RemoteCommitListener`
  Overrides:
    `close` in class `AbstractCacheImpl`

### endConfiguration

    public void endConfiguration()

  Description copied from interface: `Configurable`
  Invoked upon completion of bean property configuration for this object.
  Overrides:
    `endConfiguration` in class `AbstractCacheImpl`

### afterCommit

    public void afterCommit(RemoteCommitEvent event)

  Description copied from interface: `RemoteCommitListener`
  Notification that a transaction associated with a different PersistenceManagerFactory has successfully committed.
  Specified by:
    `afterCommit` in interface `RemoteCommitListener`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.2.4 generated on January 7 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.