org.hibernate.cache
Class ReadOnlyCache

java.lang.Object
  extended by org.hibernate.cache.ReadOnlyCache
All Implemented Interfaces:
CacheConcurrencyStrategy

public class ReadOnlyCache
extends Object
implements CacheConcurrencyStrategy

Caches data that is never updated.

See Also:
CacheConcurrencyStrategy

Constructor Summary
ReadOnlyCache()
           
 
Method Summary
 boolean afterInsert(Object key, Object value, Object version)
          Do nothing.
 boolean afterUpdate(Object key, Object value, Object version, SoftLock lock)
          Unsupported!
 void clear()
          Evict all items from the cache immediately.
 void destroy()
          Clean up all resources.
 void evict(Object key)
          Do nothing.
 Object get(Object key, long timestamp)
          Attempt to retrieve an object from the cache.
 Cache getCache()
          Get the wrapped cache implementation
 String getRegionName()
          Get the cache region name
 boolean insert(Object key, Object value, Object currentVersion)
          Do nothing.
 SoftLock lock(Object key, Object version)
          Unsupported!
 boolean put(Object key, Object value, long timestamp, Object version, Comparator versionComparator, boolean minimalPut)
          Attempt to cache an object, after loading from the database.
 void release(Object key, SoftLock lock)
          Unsupported!
 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)
          Unsupported!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReadOnlyCache

public ReadOnlyCache()
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

getRegionName

public String getRegionName()
Description copied from interface: CacheConcurrencyStrategy
Get the cache region name

Specified by:
getRegionName in interface CacheConcurrencyStrategy

get

public Object get(Object key,
                  long timestamp)
           throws CacheException
Description copied from interface: CacheConcurrencyStrategy
Attempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.

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

lock

public SoftLock lock(Object key,
                     Object version)
Unsupported!

Specified by:
lock in interface CacheConcurrencyStrategy

put

public boolean put(Object key,
                   Object value,
                   long timestamp,
                   Object version,
                   Comparator versionComparator,
                   boolean minimalPut)
            throws CacheException
Description copied from interface: CacheConcurrencyStrategy
Attempt to cache an object, after loading from the database.

Specified by:
put in interface CacheConcurrencyStrategy
timestamp - 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

release

public void release(Object key,
                    SoftLock lock)
Unsupported!

Specified by:
release in interface CacheConcurrencyStrategy

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

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

destroy

public void destroy()
Description copied from interface: CacheConcurrencyStrategy
Clean up all resources.

Specified by:
destroy in interface CacheConcurrencyStrategy

afterUpdate

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

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

evict

public void evict(Object key)
           throws CacheException
Do nothing.

Specified by:
evict in interface CacheConcurrencyStrategy
Throws:
CacheException

insert

public boolean insert(Object key,
                      Object value,
                      Object currentVersion)
Do nothing.

Specified by:
insert in interface CacheConcurrencyStrategy

update

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

Specified by:
update in interface CacheConcurrencyStrategy

toString

public String toString()
Overrides:
toString in class Object


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