@plexis/cache

0.0.22 • Public • Published

@plexis/cache

A caching mechanism for string operations.

npm i @plexis/cache

Usage

import cache from '@plexis/cache';

const toLower = x => x.toLowerCase();
const toLowerCache = cache(toLower);

// We are adding a dummy resolver function which returns the same cache every single time
const toLowerCacheWithResolver = cache(toLower, x => 'a');

toLowerCache('A'); // returns a;
toLowerCache('B'); // returns b;

toLowerCacheWithResolver('A'); // returns a;
toLowerCacheWithResolver('B'); // returns a !!;

Aliases

import cache from '@plexis/cache';
import {cache, memoize} from 'plexis';

/@plexis/cache/

    Package Sidebar

    Install

    npm i @plexis/cache

    Weekly Downloads

    10

    Version

    0.0.22

    License

    MIT

    Unpacked Size

    4.89 kB

    Total Files

    6

    Last publish

    Collaborators

    • vorillaz