0.4.5 • Published 5 years ago

objelion v0.4.5

Weekly downloads
1
License
MIT
Repository
-
Last release
5 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

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago