3 ms·
You're aware of WeakMap and WeakSet, right? You can't key by strings, but I'm not sure you'd want to.
by ralusek 8y ago
You're aware of WeakMap and WeakSet, right? You can't key by strings, but I'm not sure you'd want to.
- pixelcort 8y agoYes, but a weakref by string or number would be quite useful for ORM caching.
- pfooti 8y agoYeah weakmap and weakset basically do the opposite of what I want. The keys are weakly held rather than the values, which does no good for an ORM cache. One cannot even iterate over the keyset in a weakmap (so you can't do a lousy o(n) lookup version of what I want.