Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.cache
Class NonstrictReadWriteCache

    java.lang.Object
      org.hibernate.cache.NonstrictReadWriteCache

All Implemented Interfaces:
  CacheConcurrencyStrategy

    public class NonstrictReadWriteCache

extends Object
implements CacheConcurrencyStrategy

Caches data that is sometimes updated without ever locking the cache. If concurrent access to an item is possible, this concurrency strategy makes no guarantee that the item returned from the cache is the latest version available in the database. Configure your cache timeout accordingly! This is an "asynchronous" concurrency strategy.

Author:
  Gavin King
See Also:
  `for a much stricter algorithm`

Constructor Summary
`NonstrictReadWriteCache()`

Method Summary
`boolean` | `afterInsert(Object key, Object value, Object version)` Do nothing.
`boolean` | `afterUpdate(Object key, Object value, Object version, SoftLock lock)` Invalidate the item (again, for safety).
`void` | `clear()` Evict all items from the cache immediately.
`void` | `destroy()` Clean up all resources.
`void` | `evict(Object key)` Invalidate the item
`Object` | `get(Object key, long txTimestamp)` Get the most recent version, if available.
`Cache` | `getCache()` Get the wrapped cache implementation
`String` | `getRegionName()` Get the cache region name
`boolean` | `insert(Object key, Object value, Object currentVersion)` Invalidate the item
`SoftLock` | `lock(Object key, Object version)` Do nothing.
`boolean` | `put(Object key, Object value, long txTimestamp, Object version, Comparator versionComparator, boolean minimalPut)` Add an item to the cache.
`void` | `release(Object key, SoftLock lock)` Invalidate the item (again, for safety).
`void` | `remove(Object key)` Evict an item from the cache immediately (without regard for transaction isolation).
`void` | `setCache(Cache cache)` Set the underlying cache implementation.
`String` | `toString()`
`boolean` | `update(Object key, Object value, Object currentVersion, Object previousVersion)` Do nothing.

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

Constructor Detail

### NonstrictReadWriteCache

    public NonstrictReadWriteCache()

Method Detail

### setCache

    public void setCache(Cache cache)

  Description copied from interface: `CacheConcurrencyStrategy`
  Set the underlying cache implementation.

  Specified by:
    `setCache` in interface `CacheConcurrencyStrategy`

### getCache

    public Cache getCache()

  Description copied from interface: `CacheConcurrencyStrategy`
  Get the wrapped cache implementation

  Specified by:
    `getCache` in interface `CacheConcurrencyStrategy`

### get

    public Object get(Object key,
                      long txTimestamp)
               throws CacheException

  Get the most recent version, if available.

  Specified by:
    `get` in interface `CacheConcurrencyStrategy`
    `txTimestamp` - a timestamp prior to the transaction start time
  Returns:
    the cached object or `null`
  Throws:
    `CacheException`

### put

    public boolean put(Object key,
                       Object value,
                       long txTimestamp,
                       Object version,
                       Comparator versionComparator,
                       boolean minimalPut)
                throws CacheException

  Add an item to the cache.

  Specified by:
    `put` in interface `CacheConcurrencyStrategy`
    `txTimestamp` - a timestamp prior to the transaction start time
    `version` - the item version number
    `versionComparator` - a comparator used to compare version numbers
    `minimalPut` - indicates that the cache should avoid a put is the item is already cached
  Returns:
    `true` if the object was successfully cached
  Throws:
    `CacheException`

### lock

    public SoftLock lock(Object key,
                         Object version)
                  throws CacheException

  Do nothing.

  Specified by:
    `lock` in interface `CacheConcurrencyStrategy`
  Returns:
    null, no lock
  Throws:
    `CacheException`

### remove

    public void remove(Object key)
                throws CacheException

  Description copied from interface: `CacheConcurrencyStrategy`
  Evict an item from the cache immediately (without regard for transaction isolation).

  Specified by:
    `remove` in interface `CacheConcurrencyStrategy`
  Throws:
    `CacheException`

### clear

    public void clear()
               throws CacheException

  Description copied from interface: `CacheConcurrencyStrategy`
  Evict all items from the cache immediately.

  Specified by:
    `clear` in interface `CacheConcurrencyStrategy`
  Throws:
    `CacheException`

### destroy

    public void destroy()

  Description copied from interface: `CacheConcurrencyStrategy`
  Clean up all resources.

  Specified by:
    `destroy` in interface `CacheConcurrencyStrategy`

### evict

    public void evict(Object key)
               throws CacheException

  Invalidate the item

  Specified by:
    `evict` in interface `CacheConcurrencyStrategy`
  Throws:
    `CacheException`

### insert

    public boolean insert(Object key,
                          Object value,
                          Object currentVersion)

  Invalidate the item

  Specified by:
    `insert` in interface `CacheConcurrencyStrategy`

### update

    public boolean update(Object key,
                          Object value,
                          Object currentVersion,
                          Object previousVersion)

  Do nothing.

  Specified by:
    `update` in interface `CacheConcurrencyStrategy`

### release

    public void release(Object key,
                        SoftLock lock)
                 throws CacheException

  Invalidate the item (again, for safety).

  Specified by:
    `release` in interface `CacheConcurrencyStrategy`
  Throws:
    `CacheException`

### afterUpdate

    public boolean afterUpdate(Object key,
                               Object value,
                               Object version,
                               SoftLock lock)
                        throws CacheException

  Invalidate the item (again, for safety).

  Specified by:
    `afterUpdate` in interface `CacheConcurrencyStrategy`
  Throws:
    `CacheException`

### afterInsert

    public boolean afterInsert(Object key,
                               Object value,
                               Object version)
                        throws CacheException

  Do nothing.

  Specified by:
    `afterInsert` in interface `CacheConcurrencyStrategy`
  Throws:
    `CacheException`

### getRegionName

    public String getRegionName()

  Description copied from interface: `CacheConcurrencyStrategy`
  Get the cache region name

  Specified by:
    `getRegionName` in interface `CacheConcurrencyStrategy`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.