0.4.5 • Published 6 years ago

objelion v0.4.5

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

objelion

A cache layer for object functions

How to use

const Objelion = require('objelion');
const Redis = require('redis-node'); // it also works with ioredis

const redisClient = new Redis({
  // redis connection data
});

const objelion = new Objelion({
  enabled: true,
  cacheClient: redisClient, // by default you can use memoization
  cacheKeyRule: (fnName, args) => 'Rule to mount keys',
  expireTime: 15
});

const cacheMiddleware = objelion.createCacheMiddleware();

const targetObject = {
  sum: () => 2 + 2;
}

// will cache sum function
cacheMiddleware(targetObject).sum().then(response => console.log(response)) // 4

Installation

  $ yarn add objelion

Tests

  $ yarn test
0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago