1.0.4 • Published 6 years ago

@rnd7/rum-temporary-storage v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

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).

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago