1.1.10 • Published 2 years ago

@lindeneg/memory-cache v1.1.10

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

@lindeneg/memory-cache

typescript bundle-size license

Sandbox


React hook for caching data in-memory. If you'd like to make the cache persistent, take a look at @lindeneg/browser-cache.

Installation

yarn add @lindeneg/memory-cache

Usage

import useMemoryCache from '@lindeneg/memory-cache';

function SomeComponent() {
  const { cache } = useMemoryCache<{ id: number }>();

  // set item
  cache.set('id', 1);

  // get item
  cache.get('id');

  // listen to event
  cache.on('trim', (removed) => {
    console.log('trim removed these keys from cache: ', removed);
  });

  // and so on
}

The documentation here can be used.

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago