# Class StatementCache.CachedStatement

java.lang.Object
org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor.StatementProxy<PreparedStatement>
org.apache.tomcat.jdbc.pool.interceptor.StatementCache.CachedStatement

All Implemented Interfaces:
  `InvocationHandler`

Enclosing class:
  `StatementCache`

protected class StatementCache.CachedStatement extends StatementDecoratorInterceptor.StatementProxy<PreparedStatement>
Proxy for a cached prepared statement.

## Field Summary

### Fields inherited from class StatementDecoratorInterceptor.StatementProxy

`closed, delegate`

## Constructor Summary

Constructors
Constructor
Description
`CachedStatement(PreparedStatement parent, String sql)`
Constructs a CachedStatement.

## Method Summary

Modifier and Type
Method
Description
`void`
`closeInvoked()`
Called when the close method is invoked on the statement.
`void`
`forceClose()`
Forces immediate closure of this cached statement.
`org.apache.tomcat.jdbc.pool.interceptor.StatementCache.CacheKey`
`getCacheKey()`
Returns the cache key for this statement.
`void`
`setCacheKey(org.apache.tomcat.jdbc.pool.interceptor.StatementCache.CacheKey cacheKey)`
Sets the cache key for this statement.

### Methods inherited from class StatementDecoratorInterceptor.StatementProxy

`getActualProxy, getConnection, getConstructor, getDelegate, getSql, invoke, setActualProxy, setConnection, setConstructor, toString`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### CachedStatement

public CachedStatement(PreparedStatement parent, String sql)
Constructs a CachedStatement.

Parameters:
  `parent` - the parent prepared statement
  `sql` - the SQL text

## Method Details

### closeInvoked

public void closeInvoked()
Description copied from class: `StatementDecoratorInterceptor.StatementProxy`
Called when the close method is invoked on the statement.

Overrides:
  `closeInvoked` in class `StatementDecoratorInterceptor.StatementProxy<PreparedStatement>`

### forceClose

public void forceClose()
Forces immediate closure of this cached statement.

### getCacheKey

public org.apache.tomcat.jdbc.pool.interceptor.StatementCache.CacheKey getCacheKey()
Returns the cache key for this statement.

Returns:
  the cache key

### setCacheKey

public void setCacheKey(org.apache.tomcat.jdbc.pool.interceptor.StatementCache.CacheKey cacheKey)
Sets the cache key for this statement.

Parameters:
  `cacheKey` - the cache key