Skip to main content
Run any Skill in Manus
with one click

weak-storage

Stars0
Forks0
UpdatedMay 13, 2026 at 19:20

A Map-like collection with weakly-referenced values built on WeakRef and FinalizationRegistry. Two classes: WeakValueMap<K, V> for key→value lookup with any key type, and WeakStorage<K, V> which adds a WeakMap-backed reverse index for O(1) value→key lookup. Use when building caches that should not prevent garbage collection, tracking object associations, or attaching metadata to objects without extending their lifetime. Values must be objects (WeakRef requirement — primitives throw at runtime). Iteration and get() silently skip collected entries. approximateSize may lag GC; call verify() for an accurate count or use has() which always checks liveness.

Installation

Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.

SKILL.md
readonly