1.0.3 • Published 1 year ago

browser-caching v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

BrowserCaching with Localstorage

If you work with local storage for caching data to client side, you feel to set expire date for data. This small library will help you to solve your problem.

Install

npm i browser-caching

Example:

import { setLocalStorage, getLocalStorage } from "browser-caching";

setLocalStorage('flowgiri', 'flowgiri.com', 5)

setBrowserCache():

This function has three parameters:

  1. key for storing data with the key

  2. value Any type of data you need to store.

    Note: No need to make stringify of array or object.

  3. expireInMinute (optional). You can pass minutes for caching data till the minutes. If you do not pass expire, data will store like default localStorage.

getBrowserCache():

This function will get your data as like as you store if expire is not over. If expire over then return null.

1.0.2

1 year ago

1.0.1

1 year ago

1.0.3

1 year ago

1.0.0

1 year ago

0.0.1

9 years ago