@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
32 lines (31 loc) • 809 B
TypeScript
/**
* Class implementing reference counting cache for objects.
*
* @ignore
*/
export class RefCountedCache {
/**
* The cache. The key is the object being stored in the cache. The value is ref count of the
* object. When that reaches zero, destroy function on the object gets called and object is
* removed from the cache.
*
* @type {Map<object, number>}
*/
cache: Map<object, number>;
/**
* Destroy all stored objects.
*/
destroy(): void;
/**
* Add object reference to the cache.
*
* @param {object} object - The object to add.
*/
incRef(object: object): void;
/**
* Remove object reference from the cache.
*
* @param {object} object - The object to remove.
*/
decRef(object: object): void;
}