Skip to main content

core.memorystorage

Home > @medplum/core > MemoryStorage

MemoryStorage class

The MemoryStorage class is a minimal in-memory implementation of the Storage interface.

Signature:

export declare class MemoryStorage implements Storage 

Implements: Storage

Constructors

ConstructorModifiersDescription
(constructor)()Constructs a new instance of the MemoryStorage class

Properties

PropertyModifiersTypeDescription
lengthreadonlynumberReturns the number of key/value pairs.

Methods

MethodModifiersDescription
clear()Removes all key/value pairs, if there are any.
getItem(key)Returns the current value associated with the given key, or null if the given key does not exist.
key(index)Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
removeItem(key)Removes the key/value pair with the given key, if a key/value pair with the given key exists.
setItem(key, value)Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.