screeps-cartographer
Version:
An advanced (and open source) movement library for Screeps
10 lines (9 loc) • 614 B
TypeScript
import { CachingStrategy, GenericCachingStrategy, Serializer } from '.';
/**
* Wraps the caching method with a serializer to read/write objects from the cache.
* Assumes serializers are idempotent - same input will produce the same deserialized
* output. Caches the deserialized output so it can be looked up quickly instead of
* running the (more expensive) deserialization each tick. These caches are cleaned
* up after CREEP_LIFE_TIME ticks or when the target item is deleted.
*/
export declare const withSerializer: <T>(strategy: CachingStrategy, serializer: Serializer<T>) => GenericCachingStrategy<T>;