DrcCache
In-memory, cross-call DRC cache for the live-preview (serve) loop.
Hold a single DrcCache across reloads and pass it to
run_drc() via cache=. Re-runs then become incremental: a
change to one cell triggers DRC work proportional to that cell, not the whole
design. Results are identical to a cache-free run — only the amount of work
differs. The cache invalidates itself automatically when the rule set changes.
The cache keys per-cell results on a transitive content hash (geometry, paths,
layers, drc_skip, region waivers, and each reference's transform plus the
referenced cell's hash). A renamed-but-otherwise-identical cell is a cache hit;
editing any cell — or any cell it transitively references — is a miss.
It is in-memory only for the process lifetime; there is no on-disk cache.
from rosette import DrcCache, run_drc, load_drc_rules
rules = load_drc_rules()
cache = DrcCache()
# First call populates the cache; later calls reuse unchanged cells.
result = run_drc(cell, rules, cache=cache)
# ... edit one cell, then re-run — only that cell is re-checked:
result = run_drc(edited_cell, rules, cache=cache)This is what rosette serve uses internally so DRC re-runs on every file save
stay fast as designs grow.
Methods
func__init__() -> NoneCreate an empty cache.
Returns
Nonefunc__len__() -> intNumber of cached cell entries. Primarily for diagnostics and tests.
Returns
intfuncclear() -> NoneDrop all cached entries.
Returns
None