com.codestudio.util
Class SQLCache
java.lang.Object
|
+--com.codestudio.util.SQLCache
- All Implemented Interfaces:
- java.lang.Runnable
- public class SQLCache
- extends java.lang.Object
- implements java.lang.Runnable
Method Summary |
boolean |
cacheResult(java.lang.String origsql,
java.sql.ResultSet results)
Cache a result. |
void |
forceRefresh()
Refresh the cache explicitly. |
int |
getMaxSize()
Return the maximum possible size of the cache. |
JDBCPool |
getPool()
Retrieve the JDBCPool to which this SQLCache corresponds. |
java.util.Hashtable |
getRawCache()
Return the current cache as a Hashtable. |
java.sql.ResultSet |
getResult(java.lang.String sql)
Get a cached SQL Result. |
boolean |
removeResult(java.lang.String sql)
Remove a cached SQLResult. |
void |
run()
|
void |
setPool(JDBCPool pool)
Establish the JDBCPool to which this SQLCache corresponds. |
int |
size()
Return the size of the cache as an integer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sleeptime
protected long sleeptime
max_size
protected int max_size
cachechecker
protected java.lang.Thread cachechecker
SQLCache
public SQLCache(JDBCPool pool)
SQLCache
public SQLCache(JDBCPool pool,
int size,
int sleeptimeSecs)
getRawCache
public java.util.Hashtable getRawCache()
- Return the current cache as a Hashtable.
getPool
public JDBCPool getPool()
- Retrieve the JDBCPool to which this SQLCache corresponds.
setPool
public void setPool(JDBCPool pool)
- Establish the JDBCPool to which this SQLCache corresponds.
getResult
public java.sql.ResultSet getResult(java.lang.String sql)
- Get a cached SQL Result.
removeResult
public boolean removeResult(java.lang.String sql)
- Remove a cached SQLResult. Doesn't need to be synchronized because it is
always invoked from within a synchronized block.
- Returns:
- boolean Whether or not the operation succeeded.
cacheResult
public boolean cacheResult(java.lang.String origsql,
java.sql.ResultSet results)
- Cache a result.
size
public int size()
- Return the size of the cache as an integer.
getMaxSize
public int getMaxSize()
- Return the maximum possible size of the cache.
forceRefresh
public void forceRefresh()
- Refresh the cache explicitly.
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
Copyright © 1999-2001 The Code Studio. All Rights Reserved.