站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

Cache (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.cache
Interface Cache

All Known Implementing Classes:
EhCache, HashtableCache, JCSCache, OSCache, SwarmCache, TreeCache

public interface Cache

Implementors define a caching algorithm. All implementors must be threadsafe.


Method Summary
 void clear()
          Clear the cache
 void destroy()
          Clean up
 Object get(Object key)
          Get an item from the cache
 int getTimeout()
          Get a reasonable "lock timeout"
 void lock(Object key)
          If this is a clustered cache, lock the item
 long nextTimestamp()
          Generate a timestamp
 void put(Object key, Object value)
          Add an item to the cache
 void remove(Object key)
          Remove an item from the cache
 void unlock(Object key)
          If this is a clustered cache, unlock the item
 

Method Detail

get

public Object get(Object key)
           throws CacheException
Get an item from the cache

Parameters:
key -
Returns:
the cached object or null
Throws:
CacheException

put

public void put(Object key,
                Object value)
         throws CacheException
Add an item to the cache

Parameters:
key -
value -
Throws:
CacheException

remove

public void remove(Object key)
            throws CacheException
Remove an item from the cache

Throws:
CacheException

clear

public void clear()
           throws CacheException
Clear the cache

Throws:
CacheException

destroy

public void destroy()
             throws CacheException
Clean up

Throws:
CacheException

lock

public void lock(Object key)
          throws CacheException
If this is a clustered cache, lock the item

Throws:
CacheException

unlock

public void unlock(Object key)
            throws CacheException
If this is a clustered cache, unlock the item

Throws:
CacheException

nextTimestamp

public long nextTimestamp()
Generate a timestamp


getTimeout

public int getTimeout()
Get a reasonable "lock timeout"