yangys
2024-03-27 e48aa2ac8dea1be5db11c63edf0b912c4ad5ce65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
    }
}