public class RedisCache<K,V> extends Object implements org.apache.shiro.cache.Cache<K,V>, ExpiredCache<K,V>, ExpiredCache.Named
缓存接口实现类
Description:实现Shiro缓存接口,提供集中式缓存对象的增删查改。
ExpiredCache.Named| 构造器和说明 |
|---|
RedisCache(String name,
RedisOperations operations,
String keyPrefix,
Duration expiration,
Integer database) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear() |
V |
get(K key) |
Optional<Integer> |
getDatabase() |
Duration |
getExpiration() |
String |
getKeyPrefix() |
protected byte[] |
getKeyToBytes(K key)
Gets bytes key with key prefix.
|
String |
getName() |
RedisOperations |
getOperations() |
Set<K> |
keys()
Because the final type of the cache instance is cache<Object, Object>,
the return type of the key is a string.
|
V |
put(K key,
V value) |
V |
put(K key,
V value,
Duration expired) |
V |
remove(K key) |
protected void |
selectDatabase(RedisConnection connection) |
int |
size() |
Collection<V> |
values() |
public RedisCache(String name, RedisOperations operations, String keyPrefix, Duration expiration, Integer database)
public String getName()
getName 在接口中 ExpiredCache.Namedpublic RedisOperations getOperations()
public String getKeyPrefix()
public Duration getExpiration()
protected void selectDatabase(RedisConnection connection)
public V put(K key, V value, Duration expired) throws org.apache.shiro.cache.CacheException
put 在接口中 ExpiredCache<K,V>org.apache.shiro.cache.CacheExceptionpublic void clear()
throws org.apache.shiro.cache.CacheException
public Set<K> keys()
public Collection<V> values()
protected byte[] getKeyToBytes(K key)
Copyright © 2021. All rights reserved.