Skip to content

clayreimann/felix

 
 

Repository files navigation

felix Build Status

In-memory caching module for JavaScript

Installing

$ npm install felix
# or
$ bower install felix

Example

var felix = require('felix');
var cache = felix.create('example');

cache.put('foo', 123);
cache.put('bar', 456);
console.log(cache.get('foo')); // 123
console.log(cache.get('bar')); // 456
console.log(cache.size()); // 2

cache.remove('foo');
console.log(cache.size()); // 1

cache.clear();
console.log(cache.size()); // 0

API

felix

The top level API for felix is used to manage stored Cache objects.

felix.create(id)

Construct a cache object identified by id

felix.get(id)

Get a cache object by it's identifier

felix.remove(id)

Remove a cache by it's identifier

felix.clear()

Clear all caches

Cache

The Cache object is what is returned by felix.create and felix.get.

put(key, val)

Put a key-value pair into the cache

get(key)

Get the cached value for key

remove(key)

Remove the cached value for key

clear()

Clear all cached values

size()

Get the size of the cache

keys()

Get all the cache keys

License

MIT

About

In-memory caching module for JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.4%
  • Shell 2.6%