public class MemCachedSecondCacheImpl extends AbstractMemCachedCache implements ISecondCache
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOG
日志.
|
private static Random |
r |
expire, memClient| Constructor and Description |
|---|
MemCachedSecondCacheImpl(String s,
int expire)
构造方法.
|
| Modifier and Type | Method and Description |
|---|---|
private String |
_buildGlobalCacheKey(IQuery query,
String clusterName,
String tableName,
int version)
global second cache key.
|
private String |
_buildGlobalVersion(String clusterName,
String tableName) |
private String |
_buildShardingCacheKey(IQuery query,
DB db,
int version)
sharding second cache key.
|
String |
_buildShardingVersion(DB db) |
private boolean |
_exists(String key) |
List |
get(IQuery query,
DB db)
读取分片缓存.
|
Collection<SocketAddress> |
getAvailableServers()
获取可以用的服务链接.
|
List |
getGlobal(IQuery query,
String clusterName,
String tableName)
读取全局缓存
|
net.spy.memcached.MemcachedClient |
getMemClient() |
void |
put(IQuery query,
DB db,
List data)
添加到分片缓存.
|
void |
putGlobal(IQuery query,
String clusterName,
String tableName,
List data)
添加到全局缓存
|
void |
remove(DB db)
清除分片缓存.
|
void |
removeGlobal(String clusterName,
String tableName)
清除全局缓存.
|
void |
setMemClient(net.spy.memcached.MemcachedClient memClient) |
close, getExpirepublic static final org.slf4j.Logger LOG
private static final Random r
public MemCachedSecondCacheImpl(String s, int expire)
servers - ip:port,ip:portpublic Collection<SocketAddress> getAvailableServers()
ISecondCachegetAvailableServers in interface ISecondCachepublic void putGlobal(IQuery query, String clusterName, String tableName, List data)
ISecondCacheputGlobal in interface ISecondCachequery - 查询条件clusterName - 集群名public List getGlobal(IQuery query, String clusterName, String tableName)
ISecondCachegetGlobal in interface ISecondCachequery - 查询条件clusterName - 集群名public void removeGlobal(String clusterName, String tableName)
ISecondCacheremoveGlobal in interface ISecondCachepublic void put(IQuery query, DB db, List data)
ISecondCacheput in interface ISecondCachequery - 查询条件data - 结果集public List get(IQuery query, DB db)
ISecondCacheget in interface ISecondCachequery - 查询条件public void remove(DB db)
ISecondCacheremove in interface ISecondCacheprivate boolean _exists(String key)
private String _buildGlobalCacheKey(IQuery query, String clusterName, String tableName, int version)
private String _buildShardingCacheKey(IQuery query, DB db, int version)
public net.spy.memcached.MemcachedClient getMemClient()
public void setMemClient(net.spy.memcached.MemcachedClient memClient)
Copyright © 2015. All rights reserved.