@es-git/cache-objects-mixin

This is part of the [ES-Git](https://github.com/es-git/es-git) project.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@es-git/cache-objects-mixin
Minified + gzip package size for @es-git/cache-objects-mixin in KB

Readme

cache-objects-mixin

This is part of the ES-Git project.

Install

npm install --save @es-git/cache-objects-mixin

Usage

Mix this in with the IObjectRepo. By storing objects in a cache, loading and saving the same object multiple times will be faster.

import cacheObjectsMixin from '@es-git/cache-objects-mixin';
import objectsMixin from '@es-git/objects-mixin';
import MemoryRepo from '@es-git/memory-repo';

const Repo = mix(MemoryRepo)
            .with(objectsMixin)
            .with(cacheObjectsMixin);

const repo = new Repo({
  max: 1000,
  maxAge: 1000*60*5
});

Interfaces

The repo is the same as the object-mixin repo, but the constructor takes one parameter, options:

Options

interface Options {
  max? : number,
  maxAge? : number
};
  • max is the number of objects to store in the cache
  • maxAge is the duration, in milliseconds, to store the objects in the cache

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.