Skip to content

Commit

Permalink
feat: add ttl from last access to a few caches
Browse files Browse the repository at this point in the history
  • Loading branch information
Skelmis committed Feb 4, 2024
1 parent c2fceb8 commit cd2127c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions suggestions/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,25 @@ def __init__(self, database: SuggestionsMongoManager, bot: SuggestionsBot):
)
self.guild_cache_ttl: timedelta = timedelta(minutes=15)
self.guild_cache: TimedCache[int, disnake.Guild] = TimedCache(
global_ttl=self.guild_cache_ttl, lazy_eviction=False
global_ttl=self.guild_cache_ttl,
lazy_eviction=False,
ttl_from_last_access=True,
)
self.view_voters_cache: TimedCache[int, list[str]] = TimedCache(
global_ttl=self.autocomplete_cache_ttl, lazy_eviction=False
global_ttl=self.autocomplete_cache_ttl,
lazy_eviction=False,
ttl_from_last_access=True,
)

self.guild_configs: TimedCache = TimedCache(
global_ttl=timedelta(minutes=30), lazy_eviction=False
global_ttl=timedelta(minutes=30),
lazy_eviction=False,
ttl_from_last_access=True,
)
self.user_configs: TimedCache = TimedCache(
global_ttl=timedelta(minutes=30), lazy_eviction=False
global_ttl=timedelta(minutes=30),
lazy_eviction=False,
ttl_from_last_access=True,
)

self.existing_error_ids: Set[str] = set()
Expand Down

0 comments on commit cd2127c

Please sign in to comment.