DEFAULT_HASH
This commit is contained in:
@@ -20,6 +20,11 @@ import org.redkale.util.ThrowSupplier;
|
||||
*/
|
||||
public interface CacheManager {
|
||||
|
||||
/**
|
||||
* 默认的hash
|
||||
*/
|
||||
public static final String DEFAULT_HASH = "cache";
|
||||
|
||||
//-------------------------------------- 本地缓存 --------------------------------------
|
||||
/**
|
||||
* 本地获取缓存数据, 过期返回null
|
||||
|
||||
4
src/main/java/org/redkale/cache/Cached.java
vendored
4
src/main/java/org/redkale/cache/Cached.java
vendored
@@ -36,11 +36,11 @@ public @interface Cached {
|
||||
String key();
|
||||
|
||||
/**
|
||||
* 缓存的hash, 默认值用当前Service类的SimpleName, 不能含有':'、'#'、'@'字符
|
||||
* 缓存的hash, 不能含有':'、'#'、'@'字符
|
||||
*
|
||||
* @return hash
|
||||
*/
|
||||
String hash() default "";
|
||||
String hash() default CacheManager.DEFAULT_HASH;
|
||||
|
||||
/**
|
||||
* 本地缓存过期时长, 0表示永不过期, -1表示不作本地缓存。<br>
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.redkale.annotation.Resource;
|
||||
import org.redkale.asm.AsmDepends;
|
||||
import org.redkale.cache.CacheManager;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
import org.redkale.net.sncp.Sncp;
|
||||
import org.redkale.util.Environment;
|
||||
import org.redkale.util.MultiHashKey;
|
||||
import org.redkale.util.ThrowSupplier;
|
||||
@@ -94,7 +93,8 @@ public class CacheAction {
|
||||
|
||||
void init() {
|
||||
this.hash = cached.getHash().trim().isEmpty()
|
||||
? Sncp.getResourceType(serviceClass).getSimpleName()
|
||||
|| CacheManager.DEFAULT_HASH.equals(cached.getHash())
|
||||
? CacheManager.DEFAULT_HASH
|
||||
: environment.getPropertyValue(cached.getHash());
|
||||
String key = environment.getPropertyValue(cached.getKey());
|
||||
this.dynKey = MultiHashKey.create(paramNames, key);
|
||||
|
||||
Reference in New Issue
Block a user