next-cache

1.3.3 • Public • Published

next-cache

This is a server side rendering cache service
It is suitable for clustering and distributed application

environment

node 10.15.3
npm 6.4.1

install

npm install next-cache

start

// server
const NextCache = require("next-cache");
const server = new NextCache.Server({
    port: 666,
});
server.start();

// client
const NextCache = require("next-cache");
const cache = new NextCache.Client("ws://localhost:666");
await cache.connect();
const data = await cache.get(`your_cache_key`, async()=>{
    return await new Promise(resolve => {
        setTimeout(()=>{
            resolve({
                value: 123, // your data
                ttl: 3600,  // time to live, default is one hour
            });
        }, 1000)
    })
})

Readme

Keywords

none

Package Sidebar

Install

npm i next-cache

Weekly Downloads

91

Version

1.3.3

License

none

Unpacked Size

15.2 kB

Total Files

11

Last publish

Collaborators

  • capricair