| net.sourceforge.jtds.jdbc.cache.StatementCache
All known Subclasses: net.sourceforge.jtds.jdbc.cache.ProcedureCache,
StatementCache | public interface StatementCache (Code) | | 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:
- statement key
String generated from the SQL query for which the
prepared statement was created, the database name and the parameter
types; this key uniquely identifies a server-side preparation of the
statement and is used to retrieve the handle of the statement when it
needs to be executed
- temporary procedure name or
sp_prepare or
sp_cursorprepare handle on the server
- One
PreparedStatement can map to multiple handles, depending on
the types of the parameters it is called with (hence the need to be able
to map both keys and SQL strings to handles)
The cache can retrieve statement handles using statement keys.
The caching types provided by jTDS should be:
- Arbitrary first un-latched (initial default until other caches are
implemented)
- Fast caching (never latches and never releases handles)
- FIFO
- LRU
- No caching
- Touch Count / Most Frequently Used
author: Brian Heineman version: $Id: StatementCache.java,v 1.6 2007/07/11 19:57:06 bheineman Exp $ |
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. |
get | Object get(String key)(Code) | | 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 statement handle |
getObsoleteHandles | Collection getObsoleteHandles(Collection handles)(Code) | | 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 Collection of obsolete statement handles to beremoved |
put | void put(String key, Object handle)(Code) | | 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 Parameters: handle - the statement handle |
remove | void remove(String key)(Code) | | Removes a statement key and handle from the cache for the specified key.
Parameters: key - the statement key whose associated handle is to be removedfrom the cache |
|
|