npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

appc-cache

v0.0.2

Published

AppC cache client library

Downloads

4

Readme

Appcelerator Cache Client library Build Status

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 = require('appc-cache'),
    cache = new 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.set('key', 'value', function (err) {
    // set the value
});

cache.get('key', function (err, value) {
    console.log('cached value is', value);
});

Redis Client emulation

This library emulates the same API as the redis client. For example:

var redis = require('appc-cache');
var client = redis.createClient({
    key: 'key'
});
client.auth('secret');
var multi = client.multi();
multi.echo('OK', redis.print);
multi.exec();

Using as an Express Session Store

This library provides an Express compatible session store implementation. Example usage:

var app = express(),
    session = require('express-session'),
    Cache = require('appc-cache'),
    CacheStore = Cache.createSessionStore(session),
    options = {
        key: 'mykey',
        secret: 'mysecret',
        ttl: 2000
    };
app.use(session({
    store: new CacheStore(options),
    secret: 'keyboard cat',
    resave: false,
    saveUninitialized: false
}));

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.lock('my.lock', 10000, function (err, lock) {
    cache.unlock(lock);
});

You can extend the lock with the extend method. For example:

cache.lock('my.lock', 10000, function (err, lock) {
    // extend the lock another 10 sec
    cache.extend(lock, 10000);
    cache.unlock(lock);
});

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.