com.github.drinkjava2.jdbpro.handler
Class SimpleCacheHandler

java.lang.Object
  extended by com.github.drinkjava2.jdbpro.DefaultOrderSqlHandler
      extended by com.github.drinkjava2.jdbpro.handler.SimpleCacheHandler
All Implemented Interfaces:
SqlHandler

public class SimpleCacheHandler
extends DefaultOrderSqlHandler

SimpleCacheHandler is a simple memory cache used to cache SQL query result .

Since:
1.7.0.2
Author:
Yong Zhu

Nested Class Summary
static class SimpleCacheHandler.LRULinkedHashMap
           
 
Field Summary
 
Fields inherited from class com.github.drinkjava2.jdbpro.DefaultOrderSqlHandler
DEFAULT_ORDER, order
 
Constructor Summary
SimpleCacheHandler()
           
SimpleCacheHandler(int capacity, int aliveSeconds)
           
 
Method Summary
 void clearCache()
          Call this method to manually clear cache
 int getAliveSeconds()
           
 int getCapacity()
           
 Object handle(ImprovedQueryRunner runner, PreparedSQL ps)
          handle method is an intercept method, subClass should implement this method
 
Methods inherited from class com.github.drinkjava2.jdbpro.DefaultOrderSqlHandler
getOrder, setOrder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCacheHandler

public SimpleCacheHandler()

SimpleCacheHandler

public SimpleCacheHandler(int capacity,
                          int aliveSeconds)
Method Detail

getAliveSeconds

public int getAliveSeconds()

getCapacity

public int getCapacity()

clearCache

public void clearCache()
Call this method to manually clear cache


handle

public Object handle(ImprovedQueryRunner runner,
                     PreparedSQL ps)
Description copied from interface: SqlHandler
handle method is an intercept method, subClass should implement this method

Parameters:
runner - The ImprovedQueryRunner instance
ps - The PreparedSQL instance
Returns:
The result Object


Copyright © 2018. All rights reserved.