csrkey-cache

cache wrapper that generates its own cryptographically secure random keys. wraps lru-cache by default. ES5. TypeScript support. 582 bytes gzip.

Usage no npm install needed!

<script type="module">
  import csrkeyCache from 'https://cdn.skypack.dev/csrkey-cache';
</script>

README

csrkey-cache Join the chat at https://gitter.im/ZenyWay/csrkey-cache

NPM build status coverage status Dependency Status

a cache wrapper that generates its own cryptographically secure random keys.

by default, this module wraps lru-cache.

ES5. TypeScript support. 582 bytes gzip.

EXAMPLE

import getCache from 'csrkey-cache'
const cache = getCache() // use lru-cache with { max: 1024, maxAge: 15 * 60 * 1000 } defaults

const key = cache.set('Rob says wow!')
cache.has(key) // true
cache.get(key) // 'Rob says wow!'
cache.del(key)
cache.has(key) // false

API

ES5 and Typescript compatible. coded in Typescript 3, transpiled to ES5.

main export is the minified version. if required, e.g. for development in JS without type checks from type declarations, import resolve-call/index.js instead, which adds argument type assertion when NODE_ENV !== 'production'.

for a detailed specification of the API, run the unit tests in your browser.

note that lru-cache is the cache wrapped by default.

CONTRIBUTING

see the contribution guidelines

LICENSE

Copyright 2018 Stéphane M. Catala

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and Limitations under the License.