const e=require(`../../functions/utils/serialize.utils.cjs`),t=require(`./BaseCacheDevice.cjs`);var n=class extends t.BaseCacheDevice{isAttached=!1;get(e){return this.getInMemory(e)}set(e,t){this.setInMemory(e,t)}serialize(){return Object.fromEntries([...this.inMemoryCache].map(([t,n])=>[t,e.CustomJSONStringify(n)]))}attach(t){if(this.isAttached)throw Error(`can't reattach cache device`);return this.isAttached=!0,(...n)=>{let r=e.CustomJSONStringify(n),i=this.get(r);if(i!==void 0)return i;let a=t(...n);return this.set(r,a),a}}};exports.AttachableMemoryCacheDevice=n;