Appcelerator Cache Client library
The library makes it easy to use the Appcelerator Cache API Service. This library is meant to act as a drop-in replacement for the Node Redis Client Library.
Installation
npm install appc-cache --save
Usage
You must first include the library and create an instance. At a minimum, you must pass in the key
and secret
values for constructing the client.
var Cache = cache = key: 'MY_KEY' secret: 'MY_SECRET' ;
Once you have created the client instance, you can use it. This library is (generally) compatible with the Redis API.
cache; cache;
Redis Client emulation
This library emulates the same API as the redis client. For example:
var redis = ;var client = redis;client;var multi = client;multi;multi;
Using as an Express Session Store
This library provides an Express compatible session store implementation. Example usage:
var app = session = Cache = CacheStore = Cache options = key: 'mykey' secret: 'mysecret' ttl: 2000 ;app;
Using Distributed Locks
This library supports distributed locks. With a distributed lock, only one client can acquire a named lock at a time for a specified duration.
cache;
You can extend the lock with the extend
method. For example:
cache;
APIs that are not supported
There are a number of APIs that are not support or not allowed. For example, this library does not support shutdown
. For a full list of commands, see the file lib/blacklist.js
.
Running the Unit Tests
You can run the unit tests by setting the value of the following environment variables APPC_TEST_KEY
and APPC_TEST_SECRET
to the values to use for caching. For example:
APPC_TEST_KEY=kkkkkkkkkkkkkkkkkkkkkkkkk APPC_TEST_SECRET=ssssssssssssssssssssssss grunt
License
The library is Confidential and Proprietary to Appcelerator, Inc. and licensed under the Appcelerator Software License Agreement. Copyright (c) 2015 by Appcelerator, Inc. All Rights Reserved.