How to use google-cloud-kvstore - 1 common examples

To help you get started, we’ve selected a few google-cloud-kvstore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-datastore-kvstore / samples / quickstart.js View on Github external
/**
 * Copyright 2018 Google LLC
 *
 * Distributed under MIT license.
 * See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
 */

const {KVStore} = require('google-cloud-kvstore');
const {Datastore} = require('@google-cloud/datastore');

const datastore = new Datastore();

/**
 * Create the store
 */
const store = new KVStore(datastore);

/**
 * Set an item in the datastore.
 */
async function set() {
  await store.set('todos', ['eat', 'sleep', 'repeat']);
  console.log('Set some values in the datastore.');
}

/**
 * Get an item from datastore.
 */
async function get() {
  const todos = await store.get('todos');
  console.log('Got todos: ', todos);
}

google-cloud-kvstore

Use @google-cloud/datastore as a key-value store.

Apache-2.0
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis

Popular google-cloud-kvstore functions