Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

apinanyogaratnam/cachier-js

Repository files navigation

Cachier JS

A javascript library for interacting with a self-hosted cachier service.

Table of Contents

Installation

Install package with npm:

npm install cachier-js

Install package with yarn:

yarn add cachier-js

Install package with pnpm:

pnpm add cachier-js

You can even use multiple registries: url: https://www.npmjs.com/package/cachier-js url: https://github.com/apinanyogaratnam/cachier-js/packages/1529765

Usage

import Cachier from 'cachier-js';

const client = new Cachier('http://localhost:8000');

const setCache = async (key, value, expiry) => {
    const response = await client.set(key, value, expiry);
    console.log(response);
}

const getCache = async (key) => {
    const response = await client.get(key);
    console.log(response);
}

setCache('key', 'value', 1000).then(() => {
    getCache('key');
});

Support

Please open an issue for support.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.