org.skife.jdbi.tweak
Class CachingStatementLocator

java.lang.Object
  extended by org.skife.jdbi.tweak.CachingStatementLocator
All Implemented Interfaces:
StatementLocator

public class CachingStatementLocator
extends java.lang.Object
implements StatementLocator

Statement locator which acts as a caching decorator around another. Is used by default in conjuntion with the classpath statement locator.


Constructor Summary
CachingStatementLocator(StatementLocator locator)
          Pass in the underlying locator
 
Method Summary
 void clear()
          Remove all cached statements
 java.lang.String load(java.lang.String key)
          Will be passed the name of a statement to locate.
 boolean remove(java.lang.String key)
          Remove a specific named statement from the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingStatementLocator

public CachingStatementLocator(StatementLocator locator)
Pass in the underlying locator

Method Detail

load

public java.lang.String load(java.lang.String key)
Description copied from interface: StatementLocator
Will be passed the name of a statement to locate. Must return valid SQL (with the option of including named parameters jdbi style).

Specified by:
load in interface StatementLocator
Parameters:
key - name of the statement
Returns:
raw SQL statement (may include named params)

clear

public void clear()
Remove all cached statements


remove

public boolean remove(java.lang.String key)
Remove a specific named statement from the cache

Parameters:
key - name of statement to remove
Returns:
true if the cache changed, false otherwise