0.0.7 • Published 4 years ago

@dbgso/axios-node-cache-adapter v0.0.7

Weekly downloads
8
License
ISC
Repository
github
Last release
4 years ago

axios-node-cache-adapter

  • Axios cache adapter for Node.js
  • Created for avoiding useless request to servers.
  • Inspired by scrapy.

Usage

$ yarn add @dbgso/axios-node-cache-adapter
// or
$ npm install @dbgso/axios-node-cache-adapter
import axiso from "axios";
import { setupCache } from "axios-node-cache-adapter";
async function main() {
    const io = axiso.create({
        adapter: setupCache({
            enable: true
        }),
    })
    console.time('first')
    const first = await io.get('https://www.example.com');
    console.timeEnd('first')

    console.time('second')
    const second = await io.get('https://www.example.com');    
    console.timeEnd('second')
    
    console.time('third')
    const third = await io.get('https://www.example.com');    
    console.timeEnd('third')
    

    console.log(first.data === second.data);
    
}
main();

result

first: 537.650ms
second: 3.383ms
second: 1.678ms
true
0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago