mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-20 22:11:01 +08:00
Compare commits
6 Commits
feature/ic
...
codex/fix-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa86909598 | ||
|
|
5eb1416c6b | ||
|
|
7320df6d20 | ||
|
|
9406bf3392 | ||
|
|
ccaada8f4e | ||
|
|
35c6d29b8f |
@@ -22,6 +22,8 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Redis 缓存配置类
|
||||
@@ -80,13 +82,16 @@ public class CachingConfig {
|
||||
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer()))
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer))
|
||||
.disableCachingNullValues(); // 禁止缓存 null 值
|
||||
// 个别缓存单独设置TTL时间
|
||||
// Map<String, RedisCacheConfiguration> cacheConfigs = new HashMap<>();
|
||||
// cacheConfigs.put("openisle_tags", RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ZERO));
|
||||
// cacheConfigs.put("openisle_categories", RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ZERO));
|
||||
|
||||
// 个别缓存单独设置 TTL 时间
|
||||
Map<String, RedisCacheConfiguration> cacheConfigs = new HashMap<>();
|
||||
RedisCacheConfiguration oneHourConfig = config.entryTtl(Duration.ofHours(1));
|
||||
cacheConfigs.put(TAG_CACHE_NAME, oneHourConfig);
|
||||
cacheConfigs.put(CATEGORY_CACHE_NAME, oneHourConfig);
|
||||
|
||||
return RedisCacheManager.builder(connectionFactory)
|
||||
.cacheDefaults(config)
|
||||
.withInitialCacheConfigurations(cacheConfigs)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ spring.jpa.hibernate.ddl-auto=update
|
||||
# for redis
|
||||
spring.data.redis.host=${REDIS_HOST:localhost}
|
||||
spring.data.redis.port=${REDIS_PORT:6379}
|
||||
spring.data.redis.database=0
|
||||
spring.data.redis.database=${REDIS_DATABASE:0}
|
||||
|
||||
# for jwt
|
||||
app.jwt.secret=${JWT_SECRET:jwt_sec}
|
||||
@@ -56,7 +56,7 @@ app.captcha.comment-enabled=${CAPTCHA_COMMENT_ENABLED:false}
|
||||
# ========= Optional =========
|
||||
# for resend email send service, you can improve your service by yourself
|
||||
resend.api.key=${RESEND_API_KEY:}
|
||||
resend.from.email=${RESEND.FROM.EMAIL}
|
||||
resend.from.email=${RESEND_FROM_EMAIL:}
|
||||
# your email services: ...
|
||||
|
||||
# for tencent cloud image upload service, you can improve your service by yourself
|
||||
|
||||
Reference in New Issue
Block a user