'use strict'; /** * 아주 단순한 in-process handler cache. * key = `${type}@@${path}` * value = function(req) { ... } */ class HandlerCache { constructor() { this._map = new Map(); } _key(type, path) { return `${type}@@${path}`; } setCache(type, path, handler) { if (typeof handler !== 'function') return; this._map.set(this._key(type, path), handler); } getCache(type, path) { return this._map.get(this._key(type, path)) || null; } removeCache(type, path) { this._map.delete(this._key(type, path)); } clear() { this._map.clear(); } } module.exports = new HandlerCache();