Skip to content

An implementation of ps-cache, pubsub caching library, using pusher.com real-time messaging medium.

License

Notifications You must be signed in to change notification settings

MobiltronInc/pusher-ps-cache

Repository files navigation

pusher-ps-cache

Dependency Status

An implementation of ps-cache, pubsub caching library, using pusher.com real-time messaging medium.

Features

  • Local in memory caching
  • Real-time cache invalidation

Getting Started

var pscache = require('ps-cache');
var cache = new pscache.Cache();

//Pusher configuration
var listenerOpts = {
  cache: cache,
  app_id: ...,
  key: ...,
  secret: ...,
  cluster: ...,
  channel: ...
};

//Create pusher listener
var pusherListener = new pusherBaseListener.PusherListener(listenerOpts);
cache.attachListener(pusherListener);

var D = pscache.D;

//Set to cache and time to live 30 minutes
cache.set(key, value,{ ttl: D.THIRTY_MINUTES });

//Set to cache without TTL
cache.set(key, value,);

//Get value by key or null if key doesn't exists
cache.get(key);

//Remove from local cache and notify for global invalidation
cache.remove(key)

Requirements

Node.js >= 6.0

Installation

With npm do:

npm install pusher-ps-cache -save

About

This project is funded and maintained by Mobiltron, Inc.. We ❤️ open source software!

Check out our other open source projects or say 👋 on twitter @mobiltron.

Contribute

Contributions are welcome 🤘 We encourage developers like you to help us improve the projects we've shared with the community. Please see the Contributing Guide and the Code of Conduct.

Authors

See also the list of contributors who participated in this project.

License

pusher-ps-cache is available under the MIT license. See the LICENSE file for more info.

About

An implementation of ps-cache, pubsub caching library, using pusher.com real-time messaging medium.

Resources

License

Stars

Watchers

Forks

Packages