package com.qianwen.core.redis.cache;
|
|
import java.time.Duration;
|
import com.qianwen.core.tool.utils.ObjectUtil;
|
import com.qianwen.core.tool.utils.StringUtil;
|
import org.springframework.lang.Nullable;
|
|
/* loaded from: blade-starter-redis-9.3.0.0-SNAPSHOT.jar:org/springblade/core/redis/cache/ICacheKey.class */
|
public interface ICacheKey {
|
String getPrefix();
|
|
@Nullable
|
default Duration getExpire() {
|
return null;
|
}
|
|
default CacheKey getKey(Object... suffix) {
|
String key;
|
String prefix = getPrefix();
|
if (ObjectUtil.isEmpty(suffix)) {
|
key = prefix;
|
} else {
|
key = prefix.concat(StringUtil.join(suffix, ":"));
|
}
|
Duration expire = getExpire();
|
return expire == null ? new CacheKey(key) : new CacheKey(key, expire);
|
}
|
}
|