@rnd7/rum-temporary-storage

1.0.4 • Public • Published

Rumbullion Temporary Storage

Temporary Storage Class used within the Rumbullion toolkit. Data stored will timeout after a given period of time when not changed or at least listed.

See also:

rum

rum-storage

Download

builds

Installation

npm i @rnd7/rum-temporary-storage

Include

Via script tag

<script src="node_modules/@rnd7/rum-temporary-storage/dist/rum-temporary-storage-browser.js"></script>

Using require

const TemporaryStorage = require('@rnd7/rum-temporary-storage').TemporaryStorage

Using import

import { TemporaryStorage } from '@rnd7/rum-temporary-storage'

Usage

let myStorage = new TemporaryStorage()
let sid = 'someStorageId'
myStorage.insert({sid, myProperty: "myValue"}).then(console.log)

API

Constructor

Pass optional configuration data as opts parameter assigned directly to the instance.

new TemporaryStorage(opts)

TemporaryStorage Defaults:

{
  scheduler: true,
  ttl: 1000*60*60*24,
  touchOnFind: true,
  touchOnList: true
}

You might also pass all Storage options.

Inherited from Storage.

insert(record)
list()
find(recordOrIndex)
update(record)
upsert(recordOrIndex)
replace(record)
remove(recordOrIndex)

get/set scheduler

The wipe procedure will be invoked automatically when true.

scheduler = true || false

schedule

Schedule a wipe manually.

schedule(time)

wipe

Wipe all outdated data manually. Usually not necessary.

wipe()

touch

Restart the ttl of the given record.

touch(recordOrIndex)

Development

Installation

Install dependencies such as rum-tester, rum-maker and rum-publisher

npm install

Build

Production build

npm run build

Test

Run Tests

npm test

Publish

Publish to github and npm using

npx publish-rum -m "My commit message"

License

See the LICENSE file for software license rights and limitations (MIT).

Package Sidebar

Install

npm i @rnd7/rum-temporary-storage

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

59.1 kB

Total Files

11

Last publish

Collaborators

  • rnd7