Skip to main content

API Reference

Control APIs

Create Cache

Creates a cache with provided name

Attributes:

NameTypeDescription
cacheNameStringName of the cache to be created.

Delete Cache

Deletes a cache

Attributes:

NameTypeDescription
cacheNameStringName of the cache to be deleted.

List Caches

Lists all caches for the provided auth token.

NameTypeDescription
nextTokenStringToken for pagination of caches.

Data APIs

Set

Sets the value in cache with a given Time To Live (TTL) seconds. If a value for this key is already present it will be replaced by the new value.

NameTypeDescription
cacheNameStringName of the cache.
key[]ByteThe key under which the value is to be added.
value[]ByteThe value to be stored.
ttlSecondsintTime to Live for the item in Cache.

const authToken="eyJhbGc.MyTestToken";
const defaultTTL = 300;
const momento = new SimpleCacheClient(authToken, defaultTtl);
momento.set('test-cache', 'test-key', 'test-value');

Get

Get the cache value stored for the given key.

NameTypeDescription
cacheNameStringName of the cache.
key[]ByteThe key under which the value is to be added.

const authToken="eyJhbGc.MyTestToken";
const defaultTTL = 300;
const momento = new SimpleCacheClient(authToken, defaultTtl);
momento.get('test-cache', 'test-key');

Delete

Delete the cache value stored for the given key.

NameTypeDescription
cacheNameStringName of the cache.
key[]ByteThe key under which the value is to be deleted.

const authToken="eyJhbGc.MyTestToken";
const defaultTTL = 300;
const momento = new SimpleCacheClient(authToken, defaultTtl);
momento.get('test-cache', 'test-key');