cache#

处理所有缓存逻辑,包括
  • 从缓存检索

  • 保存到缓存

  • 确定某些项目是否已过期并需要刷新

函数#

cached_response(func)

is_notice_response_cache_expired(→ bool)

这会检查缓存响应的内容,以查看其是否已过期。

get_notices_cache_dir(→ pathlib.Path)

以 Path 对象形式返回通知缓存目录的位置

get_notices_cache_file(→ pathlib.Path)

以 Path 对象形式返回通知缓存文件的位置

get_notice_response_from_cache(...)

如果存在,则从缓存中检索通知响应对象。

write_notice_response_to_cache(→ None)

将我们的通知数据写入本地缓存位置。

mark_channel_notices_as_viewed(→ None)

将频道通知插入到我们的数据库中,并将其标记为已读。

get_viewed_channel_notice_ids(→ set[str])

返回已查看的频道通知的 ID。

属性#

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

这会检查缓存响应的内容,以查看其是否已过期。

如果由于任何原因我们在解析单个消息时遇到异常,我们假设缓存无效并返回 true。

get_notices_cache_dir() pathlib.Path#

以 Path 对象形式返回通知缓存目录的位置

get_notices_cache_file() pathlib.Path#

以 Path 对象形式返回通知缓存文件的位置

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

如果存在,则从缓存中检索通知响应对象。

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

将我们的通知数据写入本地缓存位置。

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

将频道通知插入到我们的数据库中,并将其标记为已读。

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

返回已查看的频道通知的 ID。