net.sourceforge.jtds.jdbc.cache

Interface StatementCache

Known Implementing Classes:
ProcedureCache

public interface StatementCache

Interface for a statement cache. Abstraction of the caching mechanism by use of this interface will allow developers to create custom caching schemes that are optimal for their specific applications. Any synchronization required by an implementation should utilize the implementing object for the lock.

There are two types of attributes that the cache is concerned with:

String
sp_preparesp_cursorprepare
PreparedStatement
The cache can retrieve statement handles using statement keys.

The caching types provided by jTDS should be:

Version:
$Id: StatementCache.java,v 1.6 2007/07/11 19:57:06 bheineman Exp $
Author:
Brian Heineman

Method Summary

Object
get(String key)
Returns a statement handle associated with the specified key or null if the key specified does not have an associated statement handle.
Collection
getObsoleteHandles(Collection handles)
Returns a Collection of obsolete statement handles that may be released, or null if no statement handles are obsolete.
void
put(String key, Object handle)
Places the specified statement handle in the cache for the given key.
void
remove(String key)
Removes a statement key and handle from the cache for the specified key.

Method Details

get

public Object get(String key)
Returns a statement handle associated with the specified key or null if the key specified does not have an associated statement handle.
Parameters:
key - the statement key whose associated handle is to be returned
Returns:
statement handle

getObsoleteHandles

public Collection getObsoleteHandles(Collection handles)
Returns a Collection of obsolete statement handles that may be released, or null if no statement handles are obsolete.
Parameters:
handles - the statement handles that are no longer being used
Returns:
Collection of obsolete statement handles to be removed

put

public void put(String key,
                Object handle)
Places the specified statement handle in the cache for the given key. If a key already exists in the cache, the handle will be overwritten.
Parameters:
key - the statement key to associated with the handle
handle - the statement handle

remove

public void remove(String key)
Removes a statement key and handle from the cache for the specified key.
Parameters:
key - the statement key whose associated handle is to be removed from the cache

Generated on June 12 2008