Spaces:
Running
Running
Download app/include/cache.js from chanmin0723/obcon-scada: direct link, hf CLI and curl.
- Browser
- Download file 639 Bytes
-
https://huggingface.co/spaces/chanmin0723/obcon-scada/resolve/main/app/include/cache.js
- Command line
-
hf download hf://spaces/chanmin0723/obcon-scada/app/include/cache.js
-
curl -L -o cache.js https://huggingface.co/spaces/chanmin0723/obcon-scada/resolve/main/app/include/cache.js
639 Bytes
| ; | |
| /** | |
| * 아주 단순한 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(); | |