Background
src/babel_validation/services/nodenorm.py and src/babel_validation/services/nameres.py both implement identical cache structures:
(query, frozenset(params.items())) tuple keys
- Parallel
clear_curie / delete_query O(N) sweep methods
- Parallel
from_url registries
This duplication means bug fixes or improvements to the cache logic must be applied in two places.
Proposed fix
Extract a small _KeyedCache helper (or a shared base class / mixin) in src/babel_validation/services/ that both CachedNodeNorm and CachedNameRes can reuse. Not blocking for the current PR, but worth cleaning up as the services layer grows.
Notes
Background
src/babel_validation/services/nodenorm.pyandsrc/babel_validation/services/nameres.pyboth implement identical cache structures:(query, frozenset(params.items()))tuple keysclear_curie/delete_queryO(N) sweep methodsfrom_urlregistriesThis duplication means bug fixes or improvements to the cache logic must be applied in two places.
Proposed fix
Extract a small
_KeyedCachehelper (or a shared base class / mixin) insrc/babel_validation/services/that bothCachedNodeNormandCachedNameRescan reuse. Not blocking for the current PR, but worth cleaning up as the services layer grows.Notes