cache#

Handles all caching logic including:
  • Retrieving from cache

  • Saving to cache

  • Determining whether not certain items have expired and need to be refreshed

Functions#

cached_response(func)

is_notice_response_cache_expired(→ bool)

This checks the contents of the cache response to see if it is expired.

get_notices_cache_dir(→ pathlib.Path)

Returns the location of the notices cache directory as a Path object

get_notices_cache_file(→ pathlib.Path)

Returns the location of the notices cache file as a Path object

get_notice_response_from_cache(...)

Retrieves a notice response object from cache if it exists.

write_notice_response_to_cache(→ None)

Writes our notice data to our local cache location.

mark_channel_notices_as_viewed(→ None)

Insert channel notice into our database marking it as read.

get_viewed_channel_notice_ids(→ set[str])

Return the ids of the channel notices which have already been seen.

Attributes#

logger#
cached_response(func)#
is_notice_response_cache_expired(channel_notice_response: conda.notices.types.ChannelNoticeResponse) bool#

This checks the contents of the cache response to see if it is expired.

If for whatever reason we encounter an exception while parsing the individual messages, we assume an invalid cache and return true.

get_notices_cache_dir() pathlib.Path#

Returns the location of the notices cache directory as a Path object

get_notices_cache_file() pathlib.Path#

Returns the location of the notices cache file as a Path object

get_notice_response_from_cache(url: str, name: str, cache_dir: pathlib.Path) conda.notices.types.ChannelNoticeResponse | None#

Retrieves a notice response object from cache if it exists.

write_notice_response_to_cache(channel_notice_response: conda.notices.types.ChannelNoticeResponse, cache_dir: pathlib.Path) None#

Writes our notice data to our local cache location.

mark_channel_notices_as_viewed(cache_file: pathlib.Path, channel_notices: Sequence[conda.notices.types.ChannelNotice]) None#

Insert channel notice into our database marking it as read.

get_viewed_channel_notice_ids(cache_file: pathlib.Path, channel_notices: Sequence[conda.notices.types.ChannelNotice]) set[str]#

Return the ids of the channel notices which have already been seen.