Cache.d.ts 777 B

123456789101112131415161718
  1. export type KeyType = string | number;
  2. type ValueType = [number, any];
  3. /** Connect key with `SPLIT` */
  4. export declare function pathKey(keys: KeyType[]): string;
  5. declare class Entity {
  6. instanceId: string;
  7. constructor(instanceId: string);
  8. /** @private Internal cache map. Do not access this directly */
  9. cache: Map<string, ValueType>;
  10. extracted: Set<string>;
  11. get(keys: KeyType[]): ValueType | null;
  12. /** A fast get cache with `get` concat. */
  13. opGet(keyPathStr: string): ValueType | null;
  14. update(keys: KeyType[], valueFn: (origin: ValueType | null) => ValueType | null): void;
  15. /** A fast get cache with `get` concat. */
  16. opUpdate(keyPathStr: string, valueFn: (origin: ValueType | null) => ValueType | null): void;
  17. }
  18. export default Entity;