Class: SsRefCache<T>
Defined in: packages/react-native-spritestudio/src/core/SsRefCache.ts:40
Type Parameters
T
T
Constructors
Constructor
new SsRefCache<
T>(options?):SsRefCache<T>
Defined in: packages/react-native-spritestudio/src/core/SsRefCache.ts:44
Parameters
options?
Returns
SsRefCache<T>
Accessors
size
Get Signature
get size():
number
Defined in: packages/react-native-spritestudio/src/core/SsRefCache.ts:128
Entries currently held, for diagnostics and the leak check's readout.
Returns
number
Methods
acquire()
acquire(
key,create):Promise<T>
Defined in: packages/react-native-spritestudio/src/core/SsRefCache.ts:59
Takes a lease on key, building it with create on the first one.
The refcount is incremented synchronously, before any await, so two mounts racing on one pack share a single build rather than each starting their own — and so a caller that releases while the build is still in flight is counted correctly rather than dropping a lease that was never taken.
Every successful acquire must be balanced by exactly one release.
Parameters
key
string
create
() => Promise<T>
Returns
Promise<T>
clear()
clear():
void
Defined in: packages/react-native-spritestudio/src/core/SsRefCache.ts:123
Drops everything, retained entries included.
The leak check runs this first: a cache holding packs is indistinguishable from a leak when the measurement is a count of live handles.
Returns
void
release()
release(
key):void
Defined in: packages/react-native-spritestudio/src/core/SsRefCache.ts:85
Gives back one lease, destroying the value when it was the last.
Parameters
key
string
Returns
void
releaseRetained()
releaseRetained(
key):void
Defined in: packages/react-native-spritestudio/src/core/SsRefCache.ts:109
Gives back one retain() lease, if one is held.
Parameters
key
string
Returns
void
retain()
retain(
key):void
Defined in: packages/react-native-spritestudio/src/core/SsRefCache.ts:101
Takes a lease that no release will ever balance — what preload holds.
Counted, one releaseRetained each: two packs that share an atlas each retain it, and unloading one must leave it for the other. Preloading the same pack twice is ssPreload's to fold, and it does.
Parameters
key
string
Returns
void