utils/storage
Key-Value Store Service
  README.md
# StdLib Key-Value Storage This is a highly available backend key-value storage service. As with all StdLib services, it is available in [Node](https://github.com/stdlib/lib-node), [Python](https://github.com/stdlib/lib-python), [Ruby](https://github.com/stdlib/lib-ruby), and [JavaScript (Web)](https://github.com/stdlib/lib-js). All keys are converted to strings, and values must be JSON-serializable. Arrays will be converted into Objects with numeric indices. Your storage is scoped to the active StdLib user account based on the Library Token you used to authenticate. ## Usage You **must** be authenticated with a StdLib Library Token to use this service. You can do that by initializing `lib` like this: ```javascript // Retrieve your Library Token on the StdLib Dashboard const lib = require('lib')({token: STDLIB_LIBRARY_TOKEN}); ``` You can find your token in your [dashboard](https://dashboard.stdlib.com/dashboard). ### storage.set Setting key-value pairs is easy. `storage.set` accepts JSON-serializable objects, base types including string, number, boolean and null, and will convert Arrays into Objects with numeric indices. ```javascript // Set a String lib.utils.storage.set('key', 'value', (err, value) => { // Do something with result }); // Or set an Object value lib.utils.storage.set('key', {content: 1}, (err) => { // Do something with result }); ``` ### storage.get To retrieve a previously set key-value pair, use `storage.get`. Note that this method will **return an error if the key-value pair has not previously been set**. ```javascript // Get a key's value lib.utils.storage.get('key', (err, value) => { // Do something with result }); ``` ### storage.clear To clear a previously set key, use `storage.clear`. Note that this method will **return an error if the key-value pair has not previously been set**. ```javascript lib.utils.storage.clear('key', (err, value) => { // Do something with result }); ```
  Published by keith on Monday, March 20th, 2017, 2:20:14 AM
This service has 3 functions
  get default function
  Pricing
 per request
 per second
  Get value for key
   Arguments
[0] key
   Keyword Arguments
No Keyword Arguments Expected
  set
  Pricing
 per request
 per second
  Set value for given key
   Arguments
[0] key
[1] value
   Keyword Arguments
No Keyword Arguments Expected
   HTTPS Execution
https://utils.stdlib.com/storage/set
  clear
  Pricing
 per request
 per second
  Clears key
   Arguments
[0] key
   Keyword Arguments
No Keyword Arguments Expected