Dark

storage

cache

Quick access key-value storage

Introduction

The cache service provides simple get/set/delete key-value storage. Values can be stored with an optional time-to-live (TTL) to automatically expire entries. The max value size is 1MB.

How to use

1. Firstly install the Micro node package

npm install @m3o/m3o-node --save

2. To consume any of the Micro APIs requires an API key. This can generated in the admin section. Once this is acquired, you just need to use this within your chosen API. All APIs follow the same pattern which you can see below:

1import m3o from '@m3o/m3o-node';
2
3const client = new m3o.Client({ token: 'INSERT_YOUR_YOUR_M3O_API_KEY_HERE' });
4
5client.call('API_NAME', 'API_METHOD', API_PAYLOAD)
6  .then(response => {
7    console.log(response);
8  });

3. So, for example to consume the method on the DB:

1import m3o from '@m3o/m3o-node';
2
3const client = new m3o.Client({ token: 'INSERT_YOUR_YOUR_M3O_API_KEY_HERE' });
4
5client.call('cache', 'Decrement', {
6  "key": "",
7  "value": 0
8})
9  .then(response => {
10    console.log(response);
11  });

Authors

Asim
Dom

Feedback

Looking for something you can't find??

Let us know