Depends on #1. Screen-level teardown wants "release everything this screen assembled — except the entries that must survive".
Concrete consumer case: a settings screen assembles 11 sprite-sheet variants for a theme gallery; on close, only the currently active theme's sheet may stay alive (and "active" can have just changed inside that very gallery, so the exemption must be computed at call time, not snapshotted at open).
If consumers keep their own list of assembled paths in order to release them one by one, that list becomes a second source of truth for what the cache holds. The cache owner should accept the exemption list instead.
Proposal:
releaseAll(options?: { keep?: string[] }): void
keep entries are normalized with the same toMapKey rules as ensure()/release().
Depends on #1. Screen-level teardown wants "release everything this screen assembled — except the entries that must survive".
Concrete consumer case: a settings screen assembles 11 sprite-sheet variants for a theme gallery; on close, only the currently active theme's sheet may stay alive (and "active" can have just changed inside that very gallery, so the exemption must be computed at call time, not snapshotted at open).
If consumers keep their own list of assembled paths in order to release them one by one, that list becomes a second source of truth for what the cache holds. The cache owner should accept the exemption list instead.
Proposal:
keepentries are normalized with the sametoMapKeyrules asensure()/release().