public class MemCache extends Object implements Level2Cache
Constructor and Description |
---|
MemCache(String region,
net.rubyeye.xmemcached.MemcachedClient client) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the cache
|
void |
evict(String... keys)
Remove items from the cache
|
List<byte[]> |
getBytes(Collection<String> keys)
同时读取多个 Key
|
byte[] |
getBytes(String key)
读取缓存数据字节数组
|
Collection<String> |
keys()
Return all keys
|
void |
setBytes(Map<String,byte[]> bytes)
同时设置多个数据
|
void |
setBytes(Map<String,byte[]> bytes,
long timeToLiveInSeconds)
批量设置带 TTL 的缓存数据
|
void |
setBytes(String key,
byte[] bytes)
设置缓存数据字节数组
|
void |
setBytes(String key,
byte[] bytes,
long timeToLiveInSeconds)
设置缓存数据字节数组(带有效期)
|
boolean |
supportTTL()
是否支持缓存 TTL 的设置
|
public MemCache(String region, net.rubyeye.xmemcached.MemcachedClient client)
public boolean supportTTL()
Level2Cache
supportTTL
in interface Level2Cache
public byte[] getBytes(String key)
Level2Cache
getBytes
in interface Level2Cache
key
- cache keypublic List<byte[]> getBytes(Collection<String> keys)
Level2Cache
getBytes
in interface Level2Cache
keys
- multiple cache keypublic void setBytes(String key, byte[] bytes)
Level2Cache
setBytes
in interface Level2Cache
key
- cache keybytes
- cache datapublic void setBytes(Map<String,byte[]> bytes)
Level2Cache
setBytes
in interface Level2Cache
bytes
- cache datapublic void setBytes(String key, byte[] bytes, long timeToLiveInSeconds)
setBytes
in interface Level2Cache
key
- cache keybytes
- cache datatimeToLiveInSeconds
- cache ttlpublic void setBytes(Map<String,byte[]> bytes, long timeToLiveInSeconds)
setBytes
in interface Level2Cache
bytes
- cache datatimeToLiveInSeconds
- cache ttlpublic Collection<String> keys()
Level2Cache
keys
in interface Cache
keys
in interface Level2Cache
public void evict(String... keys)
Level2Cache
evict
in interface Cache
evict
in interface Level2Cache
keys
- Cache keypublic void clear()
Level2Cache
clear
in interface Cache
clear
in interface Level2Cache
Copyright © 2018. All rights reserved.