Skip to content

Commit

Permalink
Add member cache duration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed May 6, 2024
1 parent f21aaff commit 19ccf96
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import fr.shikkanime.entities.MemberFollowAnime
import fr.shikkanime.entities.MemberFollowEpisode
import fr.shikkanime.services.MemberService
import fr.shikkanime.utils.MapCache
import java.time.Duration
import java.util.*

class MemberCacheService : AbstractCacheService {
Expand All @@ -19,7 +20,10 @@ class MemberCacheService : AbstractCacheService {
}

private val findPrivateMemberCache =
MapCache<String, MemberDto?>(classes = listOf(Member::class.java, MemberFollowAnime::class.java, MemberFollowEpisode::class.java)) {
MapCache<String, MemberDto?>(
duration = Duration.ofHours(1),
classes = listOf(Member::class.java, MemberFollowAnime::class.java, MemberFollowEpisode::class.java),
) {
memberService.findPrivateMember(it)
?.let { member -> AbstractConverter.convert(member, MemberDto::class.java) }
}
Expand Down

0 comments on commit 19ccf96

Please sign in to comment.