Copyright 2015 Randal L Kamradt Sr.
Memory Storage. Makes a shallow copy of all objects stored and returned
(require("meta-data/mem-storage"))(model) → {Object}
A memory store API.
Parameters:
Name | Type | Description |
---|---|---|
model |
Object | The model description |
- Source:
Returns:
The API Object
- Type
- Object
- Source:
Methods
(inner) add(data, done)
add an item to the store
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The item to store |
done |
function | The callback when done |
- Source:
(inner) find(key, done)
return an item by id
Parameters:
Name | Type | Description |
---|---|---|
key |
String | The key value |
done |
function | The callback when done |
- Source:
(inner) findAll(done)
return the entire store as an Array
Parameters:
Name | Type | Description |
---|---|---|
done |
function | The callback when done |
- Source:
(inner) load(data, done)
load an array of data into a store
Parameters:
Name | Type | Description |
---|---|---|
data |
Array | The data to load |
done |
function | The callback when done |
- Source:
(inner) remove(key, done)
Remove an item by key
Parameters:
Name | Type | Description |
---|---|---|
key |
String | The key value |
done |
function | The callback when done |
- Source:
(inner) update(data, done)
update an item in the store
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The item to update |
done |
function | The callback when done |
- Source: