New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

storage-ttl

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

storage-ttl

localStorage objets and ttl manager Edit

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

storage NPM version

Basic object store for javascript

Install with npm

npm i storage-ttl --save

Usage

var storage = require('storage-ttl');

.set

  • key {String}
  • value {*}
storage.set('foo', {bar: 'bar'})
storage.set('foo', 'value')

Assign value to key.

.setTTL

  • key {String}
  • value {*}
  • ttl {Number}: value in minutes
storage.setTTL('foo', {bar: 'bar'}, 1)
storage.setTTL('foo', 'value', 1)

Assign value to key with a ttl.

.get

  • key {String}
  • returns {*}: Returns the stored value of key
const value = storage.get('foo')

Get the stored value of key.

.remove

  • key {String}
storage.remove('foo')

Removes the stored value of key.

.count

const count = storage.count()

Gets the stored keys count.

.all

const items = storage.all()

Gets all the stored keys.

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

João Moura

License

Copyright (c) 2017 João Moura Released under the BSD 2-clause "Simplified" License

Keywords

localstorage

FAQs

Package last updated on 31 Aug 2017

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