1.9.2 • Published 8 years ago

collection-sync-cache v1.9.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Proxy-Cache

A simple singleton and proxy pattern approach to maintain a single customizable collection in the whole app

Travis Codecov npm

Installation

npm install collection-sync-cache --save

Usage

import {Cache} from 'collection-sync-cache';
let cache = new Cache();
cache.syncObj({_id:1});

Middlewares

Pre Sync

cache.preSync((obj) => {
   obj.customState = 'custom';
});
cache.syncObj({_id:1});

{_id: 1, customState: 'custom'}

Post Sync

cache.postSynch((obj) => {
   console.log(`Just synched obj with _id ${obj._id}`);
});
cache.syncObj({_id:1});

Output: 'Just synched obj with _id 1

Tests

npm run test

Contributing

Take care to maintain the existing coding style. (Unless is shitty, It may be. Please tell me so) Add unit tests for any new or changed functionality. Lint and test your code. If I could do it, so can you. Use commitzen to commit. aka npm run commit

1.9.2

8 years ago

1.9.1

8 years ago

1.9.0

8 years ago

1.8.1

8 years ago

1.8.0

8 years ago

1.7.0

8 years ago

1.6.0

8 years ago

1.5.0

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago