Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dailyrandomphoto/a-cachify
Easily add a cache layer to any function.
https://github.com/dailyrandomphoto/a-cachify
Last synced: about 1 month ago
JSON representation
Easily add a cache layer to any function.
- Host: GitHub
- URL: https://github.com/dailyrandomphoto/a-cachify
- Owner: dailyrandomphoto
- License: mit
- Created: 2019-12-27T08:41:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-26T06:24:11.000Z (over 3 years ago)
- Last Synced: 2024-09-07T21:59:48.480Z (4 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# a-cachify
[![NPM Version][npm-version-image]][npm-url]
[![LICENSE][license-image]][license-url]
[![Build Status][travis-image]][travis-url]
[![code style: prettier][code-style-prettier-image]][code-style-prettier-url]Easily add a cache layer to any function.
## Installation
```sh
npm install a-cachify
```## Usages
```js
const { cachify, join } = require("a-cachify");
const Cache = require("cache-module");
const cache = new Cache();let doSomething = function (arg1, arg2) {
result = heavyWork(arg1, arg2);
return result;
};// Add a cache layer
doSomething = cachify(cache, doSomething, join);doSomething(1, 2);
doSomething(1, 2); // return the cached result
```## API
### cachify (cache, fn [ , keyMaker ][ , thisarg ])
add a cache layer to the function.
### apply (cache)
### wrap (cache)
### join
### joinN
## License
Copyright (c) 2020 [dailyrandomphoto][my-url]. Licensed under the [MIT license][license-url].
[my-url]: https://github.com/dailyrandomphoto
[npm-url]: https://www.npmjs.com/package/a-cachify
[travis-url]: https://travis-ci.org/dailyrandomphoto/a-cachify
[license-url]: LICENSE
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/a-cachify
[npm-version-image]: https://img.shields.io/npm/v/a-cachify
[license-image]: https://img.shields.io/npm/l/a-cachify
[travis-image]: https://img.shields.io/travis/dailyrandomphoto/a-cachify
[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square