net.spy.db
Class SpyCacheDB

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.db.SpyDB
          extended by net.spy.db.SpyCacheDB
Direct Known Subclasses:
DBSP

public class SpyCacheDB
extends SpyDB

Extensions to DB that allow for result set caching. Use wisely!


Field Summary
 
Fields inherited from class net.spy.db.SpyDB
INIT_FROM_CONFIG, INIT_FROM_CONN
 
Constructor Summary
SpyCacheDB(java.sql.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.
 
Method Summary
 java.sql.ResultSet executeQuery(java.lang.String query, long lifetime)
          Execute if we don't have valid cache.
 java.sql.PreparedStatement prepareStatement(java.lang.String query, long lifetime)
          Prepare a statment for caching.
 
Methods inherited from class net.spy.db.SpyDB
close, dbquoteStr, executeQuery, executeUpdate, freeDBConn, getConfig, getConn, getInitType, getSource, init, isClosed, prepareCall, prepareStatement
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpyCacheDB

public SpyCacheDB(SpyConfig conf)
           throws java.sql.SQLException
Get a SpyCacheDB object as specified in the passed in config file.

Throws:
java.sql.SQLException - never, but it might someday.
See Also:
SpyConfig

SpyCacheDB

public SpyCacheDB(java.sql.Connection conn)
Get a SpyCacheDB object that will use the given Connection object for any needed queries.

Method Detail

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String query,
                                       long lifetime)
                                throws java.sql.SQLException
Execute if we don't have valid cache.

Parameters:
query - Query to execute
lifetime - How long (in seconds) the results can live
Throws:
java.sql.SQLException - when bad stuff happens

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String query,
                                                   long lifetime)
                                            throws java.sql.SQLException
Prepare a statment for caching.

Parameters:
query - Query to prepare
lifetime - How long (in seconds) the results can live
Throws:
java.sql.SQLException - when bad stuff happens


Copyright © 1995-2005 SPY Internetworking. All Rights Reserved.