Skip to content

Prefixes

W. "Mac" McMeans edited this page May 29, 2022 · 13 revisions

When on the same domain, prefixes are the only thing that help keep your storage keys from being overwritten by someone else's use of localStorage. Prefixes also let you instantiate more than one copy of localDataStorage and use the same keys with each, provided you specify unique values.

Prefixes are strongly encouraged but are not mandatory and must be specified when localDataStorage starts up.

EXAMPLES:

Start the software specifying a prefix
z = localDataStorage( 'mac' ); -->
localDataStorage instantiated. The specified prefix (mac.) adds 4 bytes to every key name (stored using 8 bytes).

Start the software forcing no prefix
z = localDataStorage( '' ); -->
Empty prefix given (), but a usable prefix is strongly recommended to organize keys!
localDataStorage instantiated. The specified prefix () adds 0 bytes to every key name (stored using 0 bytes).

Start the software getting a random prefix
z = localDataStorage(); -->
No prefix specified. Creating a random prefix --> 1588540882487:252103633.
localDataStorage instantiated. The random prefix (1588540882487:252103633.) adds 24 bytes to every key name (stored using 48 bytes).

When starting localDataStorage, you may also use a few switches.

localStorage Keys

The usual suspects:

set / get      clear      key      remove

The esoteric ones:

Array Keys:
push / pull, pullall      poke      contains      where

Broadcasting:
broadcast

Bypass:
forceset / forceget

Data Transfer:
import / export

Duplicates:
countdupes, showdupes, listdupes

Internals:
cancrunch      crunch / uncrunch

shufflestring / unshufflestring

xorstring

Management:
keys

Memory Consumption:

Memory Quota:
showquota

Query:
haskey, hasval, hastype

Security:
safeset / safeget

setscramblekey / getscramblekey

Type Check:
isarray      isbigint      isboolean      iscrunch

isdate      isfloat      isinteger      isnull

isnumber      isobject      isstring

showtype

Utility:
chopget      copy      softset      rename

Properties:

channel      length      quota      version

Settings:

verbosity

Memory Keys

Standard:

_set / _get      _clear      _key      _remove

Unconventional:

Data Sync:
_backup / _restore

Management:
_keys

Security:
_safeset / _safeget

Type Check:
_isarray      _isbigint      _isboolean      _iscrunch

_isdate      _isfloat      _isinteger      _isnull

_isnumber      _isobject      _isstring

_showtype

Utility:
_chopget      _copy      _softset      _rename

Clone this wiki locally