qcc_kplugin.qcache¶
Cache and background loading of the slow qcc components … queries (list, parameters, outline).
Each call starts Python and imports the library (~1.4 s). Called synchronously from the panel that froze KLayout, so:
results are cached in memory and in one JSON file in the temp folder (so the next KLayout start is instant too);
the cache is valid for one library key: the
qccpath and time, and the newest modification time undersrc/quantcore_circuits/layoutswhen the plugin runs from the repository. A library change refreshes everything;fetch()runs a query in a subprocess polled from a timer and callsdone(data)when it is there, at once when the result is cached.dataisNonewhenqccfailed.
Names used by the panel: list:<source>, schema:<cell>, outline:<cell>:<params JSON>, plus the bulk
schemas:quantcore that fills every schema:<cell> in one call (prefetch).
Attributes¶
Functions¶
|
Forget everything (the panel's Refresh list). |
|
|
|
The cached value of |
|
qcc path + its mtime + newest mtime of the library sources (re-evaluated at most every 2 s). |
|
|
|
|
|
Collect the finished queries and call their callbacks; True while something still runs. |
|
|
|
|
|
Block until nothing is pending (tests only). |
Module Contents¶
- qcc_kplugin.qcache.clear() None¶
Forget everything (the panel’s Refresh list).
- qcc_kplugin.qcache.fetch(name: str, args: list[str], done=None, bulk: bool = False) None¶
done(data)with the JSON ofqcc *args— at once whennameis cached, else after the background run.
- qcc_kplugin.qcache.get(name: str)¶
The cached value of
name(None when absent or from another library version).
- qcc_kplugin.qcache.library_key() str¶
qcc path + its mtime + newest mtime of the library sources (re-evaluated at most every 2 s).
- qcc_kplugin.qcache.loads_tolerant(text: str)¶
json.loadsfor what aqcccall printed. Some Quantum Metal calls print a warning line on stdout before the JSON (FutureWarning: ...): then the JSON is the last line that starts with{or[.
- qcc_kplugin.qcache.outline_key(cell: str, params_json: str) str¶
- qcc_kplugin.qcache.poll() bool¶
Collect the finished queries and call their callbacks; True while something still runs.
- qcc_kplugin.qcache.put(name: str, value, save: bool = True) None¶
- qcc_kplugin.qcache.schema_key(cell: str) str¶
- qcc_kplugin.qcache.wait(timeout: float = 60.0) None¶
Block until nothing is pending (tests only).
- qcc_kplugin.qcache.CACHE_FILE¶
- qcc_kplugin.qcache.LAYOUTS¶
- qcc_kplugin.qcache.PENDING: dict[str, dict]¶