localstorage-memory
localStorage-compatible API, but only stored in memory
localStorageMemory
provides all methods that localStorage
in browsers
provides, but no data is persisted, it's only stored in memory. It can
be used as a drop-in replacement, the only exception being the
Associative array syntax localStorage['myKey'] = 'myValue'
.
Download or Installation
- Download localstorage-memory.js
- or: install via Bower:
bower install --save localstorage-memory
- or: install via npm:
npm install --save localstorage-memory
Usage
localStorageMemory.getItem('unknown')
localStorageMemory.setItem('foo', 123)
localStorageMemory.getItem('foo')
localStorageMemory.length
localStorageMemory.key(0)
localStorageMemory.clear()
localStorageMemory.length
Related
License
MIT