@es-git/cache-objects-mixin
TypeScript icon, indicating that this package has built-in type declarations

0.10.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @es-git/cache-objects-mixin

Weekly Downloads

1

Version

0.10.0

License

MIT

Unpacked Size

57.4 kB

Total Files

23

Last publish

Collaborators

  • mariusgundersen