LruStatementCache (Bitronix Transaction Manager :: Core 2.1.4 API)
Date: 2013-09-15

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## bitronix.tm.resource.jdbc
Class LruStatementCache

    java.lang.Object
      bitronix.tm.resource.jdbc.LruStatementCache

    public class LruStatementCache

extends Object

Last Recently Used PreparedStatement cache with eviction listeners support implementation.

Author:
  lorban, brettw

Constructor Summary
`LruStatementCache(int maxSize)`

Method Summary
`void` | `addEvictionListener(LruEvictionListener listener)`
`protected void` | `clear()` Evict all statements from the cache.
`JdbcPreparedStatementHandle` | `get(JdbcPreparedStatementHandle key)` The provided key is just a 'shell' JdbcPreparedStatementHandle, it comes in with no actual 'delegate' PreparedStatement.
`JdbcPreparedStatementHandle` | `put(JdbcPreparedStatementHandle key)` A statement is put into the cache.
`void` | `removeEvictionListener(LruEvictionListener listener)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LruStatementCache

    public LruStatementCache(int maxSize)

Method Detail

### get

    public JdbcPreparedStatementHandle get(JdbcPreparedStatementHandle key)

  The provided key is just a 'shell' JdbcPreparedStatementHandle, it comes in with no actual 'delegate' PreparedStatement. However, it contains all other pertinent information such as SQL statement, autogeneratedkeys flag, cursor holdability, etc. See the equals() method in the JdbcPreparedStatementHandle class. It is a complete key for a cached statement. If there is a matching cached PreparedStatement, it will be set as the delegate in the provided JdbcPreparedStatementHandle.

  Parameters:
    `key` - the cache key
  Returns:
    the cached JdbcPreparedStatementHandle statement, or null

### put

    public JdbcPreparedStatementHandle put(JdbcPreparedStatementHandle key)

  A statement is put into the cache. This is called when a statement is first prepared and also when a statement is closed (by the client). A "closed" statement has it's usage counter decremented in the cache.

  Parameters:
    `key` - a prepared statement handle
  Returns:
    a prepared statement

### clear

    protected void clear()

  Evict all statements from the cache. This likely happens on connection close.

### addEvictionListener

    public void addEvictionListener(LruEvictionListener listener)

### removeEvictionListener

    public void removeEvictionListener(LruEvictionListener listener)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013 Bitronix Software. All Rights Reserved.