import { IParamParent, IData } from 'app/nodes/configs.interfaces'; export class GenericCache { _cache = {}; _getKey: (item: T) => string; constructor(getKey: (item: T) => string) { this._getKey = getKey; } set(data: T, value) { const key = this._getKey(data); this._cache[key] = value; console.log('set data', this._cache); } get(data: T) { const key = this._getKey(data); console.log('get data', this._cache); return this._cache[key]; } }