Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize: cache in episode save #723

Merged
merged 3 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

更新日志文档,版本顺序从新到旧,最新版本在最前(上)面。

# 0.19.2

## 优化

- 优化剧集保存时的缓存配置

# 0.19.1

## 问题修复
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.19.0
version=0.19.2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.r2dbc.core.DatabaseClient;
Expand Down Expand Up @@ -48,7 +47,12 @@ public DefaultEpisodeService(EpisodeRepository episodeRepository,


@Override
@CachePut(value = "episodeWithName", key = "#episode.name")
@CacheEvict(value = {"episodeWithId", "episodesWithSubjectId",
"episodeWithSubjectIdAndGroupAndSeqAndName",
"episodesWithSubjectIdAndGroupAndSeq",
"episodeCountWithSubjectId", "episodeMatchingCountWithSubjectId",
"episodesWithId", "episodeWithName"
}, allEntries = true)
public Mono<Episode> save(Episode episode) {
Assert.notNull(episode, "episode must not be null");
Long episodeId = episode.getId();
Expand Down Expand Up @@ -166,8 +170,7 @@ public Flux<EpisodeResource> findResourcesById(Long episodeId) {
"episodesWithSubjectIdAndGroupAndSeq",
"episodeCountWithSubjectId", "episodeMatchingCountWithSubjectId",
"episodesWithId", "episodeWithName"
},
allEntries = true)
}, allEntries = true)
public Flux<Episode> updateEpisodesWithSubjectId(Long subjectId, List<Episode> episodes) {
Assert.isTrue(subjectId >= 0, "'subjectId' must >= 0.");
Assert.notNull(episodes, "'episodes' must not be null.");
Expand Down
Loading