tf2-item-format
Version:
Format's TF2 items like backpack.tf does
29 lines (28 loc) • 898 B
TypeScript
import { ISchema } from '../types/schema';
export declare class SchemaCacheArticle<T> {
/**
* Versioning number of said schema to determine
* if we need to recalculate cached values in order
* to be able to work correctly.
*/
version: number;
value: T;
constructor(version: number, value: T);
/**
* Is this article outdated and needs to be renewed?
*
* @param version Of current schema
* @returns true, if outdated, otherwise false
*/
isOutdated(version: number): boolean;
}
export declare class SchemaCache {
protected schemaStorage: Map<ISchema, Map<string, SchemaCacheArticle<any>>>;
get<T>(schema: ISchema, key: string): T | null;
save<T>(schema: ISchema, key: string, value: T): void;
}
/**
* Global cache for all schemas, because
* we index by said schema object.
*/
export declare const cache: SchemaCache;