uniqc.backend_cache module#

Disk cache for platform backend information.

Cache file layout#

~/.uniqc/cache/backends.json

Top-level dict with one key per platform:

{
  "originq": {
    "updated_at": "2026-04-28T12:00:00Z",
    "backends": [BackendInfo, ...]
  },
  "quafu": { ... },
  "ibm": { ... }
}

Cache TTL#

Each platform entry is considered stale after 24 hours. The update() function bypasses this check when called explicitly (uniqc backend update).

uniqc.backend_cache.cache_info(cache_dir=None)[source]#

Return a human-readable summary of what’s in the cache.

Returns a dict mapping platform name to metadata (updated_at as a human-readable timestamp, is_stale bool, num_backends int).

Parameters:

cache_dir (Path | None)

Return type:

dict[str, dict[str, Any]]

uniqc.backend_cache.get_cached_backends(platform, cache_dir=None)[source]#

Return the cached BackendInfo list for platform, or an empty list.

Parameters:
Return type:

list[BackendInfo]

uniqc.backend_cache.invalidate(platform, cache_dir=None)[source]#

Remove the cached entry for platform.

Parameters:
Return type:

None

uniqc.backend_cache.invalidate_all(cache_dir=None)[source]#

Clear the entire backend cache.

Parameters:

cache_dir (Path | None)

Return type:

None

uniqc.backend_cache.is_stale(platform, cache_dir=None)[source]#

Return True when the cached data for platform is absent or expired.

Parameters:
  • platform (str)

  • cache_dir (Path | None)

Return type:

bool

uniqc.backend_cache.update_cache(platform, backends, cache_dir=None)[source]#

Write backends to the cache under platform.

Parameters:
Return type:

None