net.spy.db
Class SpyCacheDB
java.lang.Object
net.spy.SpyObject
net.spy.SpyDB
net.spy.db.SpyCacheDB
- Direct Known Subclasses:
- DBSP
- public class SpyCacheDB
- extends SpyDB
Extensions to DB that allow for result set caching. Use wisely!
|
Constructor Summary |
SpyCacheDB(Connection conn)
Get a SpyCacheDB object that will use the given Connection object
for any needed queries. |
SpyCacheDB(SpyConfig conf)
Get a SpyCacheDB object as specified in the passed in config file. |
| Methods inherited from class net.spy.SpyDB |
close, dbquoteStr, executeQuery, executeUpdate, freeDBConn, getConfig, getConn, getInitType, getSource, init, isClosed, prepareCall, prepareStatement |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SpyCacheDB
public SpyCacheDB(SpyConfig conf)
throws SQLException
- Get a SpyCacheDB object as specified in the passed in config file.
- Throws:
SQLException - never, but it might someday.- See Also:
SpyConfig
SpyCacheDB
public SpyCacheDB(Connection conn)
- Get a SpyCacheDB object that will use the given Connection object
for any needed queries.
executeQuery
public ResultSet executeQuery(String query,
long lifetime)
throws SQLException
- Execute if we don't have valid cache.
- Parameters:
query - Query to executelifetime - How long (in seconds) the results can live
- Throws:
SQLException - when bad stuff happens
prepareStatement
public PreparedStatement prepareStatement(String query,
long lifetime)
throws SQLException
- Prepare a statment for caching.
- Parameters:
query - Query to preparelifetime - How long (in seconds) the results can live
- Throws:
SQLException - when bad stuff happens