1.3.0 • Published 2 years ago

storage-manager v1.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

storage-manager

Storage Manager module that help you manage your local and session storage

  • Support TTL functionality { minutes: 2 }
  • Support multiple values like { minutes: 3, seconds: 30 }

Installing

npm install storage-manager --save

Some examples

/**
 * Supported TTL values: { milliseconds, seconds, minutes, hours, days }
 * You can use multiple values like { minutes: 3, seconds: 30 }
 * SessionStorage works the same implementation as LocalStorage
 * */
import { LocalStorage } from 'storage-manager';

const options = { minutes: 2 }

// this will update the ttl everytime you'll get the key
LocalStorage.set('some-key', 'some-value', options)

// it will refresh the TTL of this key to it's default value (2 minutes in that case)
LocalStorage.get('some-key')
import { LocalStorage } from 'storage-manager';

// it will save the key forever untill you will remove it manually
LocalStorage.set('forever-key', 'some-value')
LocalStorage.remove('forever-key')
import { LocalStorage } from 'storage-manager';

// refreshTTL is true by default.
// refreshTTL means that everytime you'll get this key, it will refresh his TTL to what it was before
const options = { minutes: 4, seconds: 30, refreshTTL: false }

LocalStorage.set('some-key', 'some-value', options)
// this will not update the ttl everytime you'll get the key

LocalStorage.get('some-key')
// it will NOT refresh the TTL of this key, this key will stay 4 minutes and 30 seconds
import { LocalStorage } from 'storage-manager';

LocalStorage.clearAll() // clear all storage
1.3.0

2 years ago

1.1.0

6 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

0.0.0

7 years ago