Skip to main content

Module list_cache

Module list_cache 

Source
Expand description

A saved copy of an integration’s repository list, so the Clone dialog shows it at once while a fresh request runs.

One JSON file per key (integration id, host, login) in a cache directory the caller names. Read leniently: a missing, corrupt, foreign version or colliding-name file is no cache. Writes go through a temp file and a rename. Never holds a token: the key is the profile id, the host and the connected login, so another account on the same profile is another entry.

Structs§

CachedList
One saved list.
ListKey
What a saved list belongs to.

Constants§

MAX_DESCRIPTION
Stored descriptions are cut to this many characters.
MAX_FILES
prune keeps at most this many files, newest first.
MAX_PROJECTS
A list longer than this is cut when stored (bounds a file to a few MB).
VERSION
File format version; any other value reads as no cache.

Functions§

load
The saved list of key, or None when absent or unreadable.
prune
Deletes every file whose key is not in live (a removed profile, a disconnected or other account), then keeps only the MAX_FILES newest. Files that do not parse are deleted too.
remove
Deletes the saved list of key.
remove_integration
Deletes every saved list of the integration id, whatever its host and login; returns how many files went. Files that do not parse are left to prune.
store
Saves list (temp file, then rename), capped and stripped of user info.