uniqc.backend_adapter.backend_cache module

Disk cache for platform backend information.

Cache file layout

~/.uniqc/backend/backends.json

Top-level dict with one key per platform:

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

The cache used to live at ~/.uniqc/cache/backends.json; on first access the legacy file is moved to the new location automatically.

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_adapter.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).

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

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

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

Remove the cached entry for platform.

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

Clear the entire backend cache.

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

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

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

Write backends to the cache under platform.