Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expired-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expired-localstorage

A library of cache based on localStorage that supports expired storage.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

expired-localstorage

A library of cache based on localStorage that supports expired storage.

Installing

Using unpkg CDN

<script src="https://unpkg.com/expired-localstorage@1.0.3/index.js"></script>

Using npm

npm install expired-localstorage --save-dev

Usage

CommonJS usage

const LS = require('expired-localstorage')

Code in Javascript

//get data
LS.get('test');
//set data with expires time
LS.set('test', 123, 60000);
//remove data
LS.remove('test');
//clear all data
LS.clear();

Method Description

Get value from localStorage

LS.get(key)

  • {String} key -> key name.(required)

Set value by localStorage

LS.set(key, value, time)

  • {String} key -> key name.(required)
  • {Any} value -> data value.(required)
  • {Number} time -> expires time, unit is ms, such as passing 60000, that means 1 minute. No value, no expiration.(optional)

Remove data from localStorage

LS.remove(key)

  • {String} key -> key name.(required)

Clear all cached data

LS.clear()

License

expired-localstorage is MIT licensed.

Keywords

FAQs

Package last updated on 14 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc