mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-07 02:27:34 +08:00
fix: 文章缓存修改为 10 min
This commit is contained in:
@@ -97,8 +97,10 @@ public class CachingConfig {
|
|||||||
// 个别缓存单独设置 TTL 时间
|
// 个别缓存单独设置 TTL 时间
|
||||||
Map<String, RedisCacheConfiguration> cacheConfigs = new HashMap<>();
|
Map<String, RedisCacheConfiguration> cacheConfigs = new HashMap<>();
|
||||||
RedisCacheConfiguration oneHourConfig = config.entryTtl(Duration.ofHours(1));
|
RedisCacheConfiguration oneHourConfig = config.entryTtl(Duration.ofHours(1));
|
||||||
|
RedisCacheConfiguration tenMinutesConfig = config.entryTtl(Duration.ofMinutes(10));
|
||||||
cacheConfigs.put(TAG_CACHE_NAME, oneHourConfig);
|
cacheConfigs.put(TAG_CACHE_NAME, oneHourConfig);
|
||||||
cacheConfigs.put(CATEGORY_CACHE_NAME, oneHourConfig);
|
cacheConfigs.put(CATEGORY_CACHE_NAME, oneHourConfig);
|
||||||
|
cacheConfigs.put(POST_CACHE_NAME, tenMinutesConfig);
|
||||||
|
|
||||||
return RedisCacheManager.builder(connectionFactory)
|
return RedisCacheManager.builder(connectionFactory)
|
||||||
.cacheDefaults(config)
|
.cacheDefaults(config)
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public class PostService {
|
|||||||
return saved;
|
return saved;
|
||||||
}
|
}
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME, allEntries = true
|
value = CachingConfig.POST_CACHE_NAME, allEntries = true
|
||||||
)
|
)
|
||||||
public Post createPost(String username,
|
public Post createPost(String username,
|
||||||
Long categoryId,
|
Long categoryId,
|
||||||
|
|||||||
Reference in New Issue
Block a user