mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
改进PreparedStatementCache
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@915 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -16,16 +16,20 @@
|
||||
package com.alibaba.druid.pool;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.alibaba.druid.pool.PoolablePreparedStatement.PreparedStatementKey;
|
||||
import com.alibaba.druid.util.LRUCache;
|
||||
|
||||
/**
|
||||
* @author wenshao<szujobs@hotmail.com>
|
||||
*/
|
||||
public class PreparedStatementPool {
|
||||
|
||||
private HashMap<PreparedStatementKey, PreparedStatement> map = new HashMap<PreparedStatementKey, PreparedStatement>();
|
||||
private final LRUCache<PreparedStatementKey, PreparedStatement> map;
|
||||
|
||||
public PreparedStatementPool(int maxSize){
|
||||
map = new LRUCache<PreparedStatementKey, PreparedStatement>(maxSize);
|
||||
}
|
||||
|
||||
public static enum MethodType {
|
||||
M1, M2, M3, M4, M5, M6, Precall_1, Precall_2, Precall_3
|
||||
@@ -40,7 +44,7 @@ public class PreparedStatementPool {
|
||||
map.put(key, poolableStatement.getRawPreparedStatement());
|
||||
}
|
||||
|
||||
public HashMap<PreparedStatementKey, PreparedStatement> getMap() {
|
||||
public LRUCache<PreparedStatementKey, PreparedStatement> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user