cachios:使用节点缓存的简单axios缓存包装器

时间:2021-02-23 10:30:42
【文件属性】:
文件名称:cachios:使用节点缓存的简单axios缓存包装器
文件大小:69KB
文件格式:ZIP
更新时间:2021-02-23 10:30:42
nodejs cache axios node-cache JavaScript 卡奇奥斯 使用node-cache简单axios缓存包装器。 Cachios旨在替代以下模式: const axios = require ( 'axios' ) ; const resources = { } ; function getResource ( id ) { if ( ! resources [ id ] ) { // actually retrieve the resource return axios . get ( `/api/thing/ ${ id } ` ) . then ( ( resp ) => { // store the resource resources [ id ] = resp . data ; return resp . data ; } ) ; } else {
【文件预览】:
cachios-master
----package.json(1KB)
----.github()
--------workflows()
----tests()
--------extended.spec.js(3KB)
--------cancel.spec.js(1KB)
--------customCache.spec.js(2KB)
--------customCache-async.spec.js(4KB)
--------create.spec.js(233B)
--------getCacheIdentifier.spec.js(1KB)
--------getResponseCopy.spec.js(1KB)
--------integration.spec.js(4KB)
----package-lock.json(193KB)
----src()
--------index.js(286B)
--------cachios.js(4KB)
--------extendPrototype.js(1KB)
----examples()
--------basic()
--------persistent-cache-sqlite-keyv()
----LICENSE.md(1KB)
----.gitignore(49B)
----CHANGELOG.md(2KB)
----README.md(7KB)
----LICENSE.txt(1KB)

网友评论