@AppKu/StashKu

@AppKu/StashKu

v1.0.46

Class

MemoryEngine

Extends

This StashKu engine is built-in and provides an in-memory data store with support for all StashKu RESTful actions and operations.

Constructor

new MemoryEngine()

Creates a new MemoryEngine instance.

Source

Members

Methods

async

delete(request) → {Promise.<module:response~Response>}

If the last item from memory is deleted, the resource is also deleted from memory (resulting in a 404 for the resource until a new record is added under that resource name).

Parameters

  • request DeleteRequest

    The DELETE request to send to the storage engine.

Returns

  • Promise.<module:response~Response>

    Returns the data objects from storage that were deleted with the request criteria.

Throws

404 Error when the requested resource is has not been stored in memory.

Source

async

get(request) → {Promise.<module:response~Response>}

Parameters

  • request GetRequest

    The GET request to send to the storage engine.

Returns

  • Promise.<module:response~Response>

    Returns the data objects from storage matching request criteria.

Throws

404 Error when the requested resource is has not been stored in memory.

Source

async

options(request) → {Promise.<module:response~Response>}

Parameters

  • request OptionsRequest

    The OPTIONS request to send to the storage engine.

Returns

  • Promise.<module:response~Response>

    Returns a response with a single data object- the dynamically created model configuration.

Throws

404 Error when the requested resource is has not been stored in memory.

Source

async

patch(request) → {Promise.<module:response~Response>}

Parameters

  • request PatchRequest

    The PATCH request to send to the storage engine.

Returns

  • Promise.<module:response~Response>

    Returns a response with the total number of the objects affected in storage. No data objects are typically returned with this request.

Throws

404 Error when the requested resource is has not been stored in memory.

Source

async

post(request) → {Promise.<module:response~Response>}

This will create the resource in memory if it does not already exist.

Parameters

  • request PostRequest

    The POST request to send to the storage engine.

Returns

  • Promise.<module:response~Response>

    Returns the data objects from storage that were created with the request criteria.

Source

async

put(request) → {Promise.<module:response~Response>}

Parameters

  • request PutRequest

    The PUT request to send to the storage engine.

Returns

  • Promise.<module:response~Response>

    Returns the data objects from storage that were updated with the request criteria. This could potentially not exactly match the objects requested to be updated, as some may have been deleted from storage or some may not match the primary key criteria.

Throws

404 Error when the requested resource is has not been stored in memory.

Source