Code Monkey home page Code Monkey logo

yocto-ttl-cache's Introduction

yocto-ttl-cache

GitHub Actions Codecov Language grade: JavaScript type-coverage npm GitHub Release

Conventional Commits Renovate enabled JavaScript Style Guide Code Style: Prettier changesets

The smallest and fastest TTL cache implementation in JavaScript

TOC

Usage

Install

# pnpm
pnpm add yocto-ttl-cache

# yarn
yarn add yocto-ttl-cache

# npm
npm i yocto-ttl-cache

API

import { TTLCache } from 'yocto-ttl-cache' // only named export is supported

const cache = new TTLCache(1000) // the `ttl` option of `constructor` is `1000` by default

cache.get('key') // `undefined`
cache.get('key', () => 'value') // get with `setter`, `'value'`
cache.get('key', () => 'unused') // `'value'` is not stale

cache.set('key', 'newValue')
cache.get('key') // `'newValue'`

setTimeout(() => {
  cache.get('key') // `undefined`, stale after `ttl`
}, 1000)

Sponsors

1stG RxTS UnTS
1stG Open Collective backers and sponsors RxTS Open Collective backers and sponsors UnTS Open Collective backers and sponsors

Backers

1stG RxTS UnTS
1stG Open Collective backers and sponsors RxTS Open Collective backers and sponsors UnTS Open Collective backers and sponsors

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT ยฉ JounQin@1stG.me

yocto-ttl-cache's People

Contributors

jounqin avatar renovate[bot] avatar github-actions[bot] avatar

Stargazers

 avatar Robert Laverty avatar  avatar

Watchers

James Cloos avatar

Forkers

lgtm-migrator

yocto-ttl-cache's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency mitata to ^0.1.11
  • chore(deps): update dependency @changesets/changelog-github to ^0.5.0
  • chore(deps): update dependency github-markdown-css to ^5.6.1
  • chore(deps): update dependency react-router-dom to ^6.26.1
  • chore(deps): update dependency size-limit to ^8.2.6
  • chore(deps): update dependency type-coverage to ^2.29.1
  • chore(deps): update dependency typescript to ^4.9.5
  • chore(deps): update pnpm to v7.33.7
  • chore(deps): update react monorepo (@types/react, @types/react-dom, react, react-dom)
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update codecov/codecov-action action to v4
  • chore(deps): update dependency @1stg/app-config to v10
  • chore(deps): update dependency @1stg/lib-config to v13
  • chore(deps): update dependency @size-limit/preset-small-lib to v11
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency size-limit to v11
  • chore(deps): update dependency typescript to v5
  • chore(deps): update jest monorepo to v29 (major) (@types/jest, jest, jest-environment-jsdom, ts-jest)
  • chore(deps): update pnpm to v9
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • codecov/codecov-action v3
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/size-limit.yml
  • actions/checkout v3
  • actions/setup-node v3
  • andresz1/size-limit-action v1
.github/workflows/vercel.yml
  • actions/checkout v3
  • actions/setup-node v3
  • amondnet/vercel-action v25
npm
docs/package.json
package.json
  • @1stg/app-config ^7.1.1
  • @1stg/lib-config ^10.1.1
  • @changesets/changelog-github ^0.4.8
  • @changesets/cli ^2.24.4
  • @isaacs/ttlcache ^1.2.1
  • @pkgr/webpack ^3.3.0
  • @pkgr/webpack-mdx ^2.1.0
  • @size-limit/preset-small-lib ^8.0.1
  • @types/jest ^28.1.8
  • @types/mdx ^2.0.3
  • @types/node ^18.7.9
  • @types/react ^18.0.28
  • @types/react-dom ^18.0.11
  • @types/web ^0.0.93
  • github-markdown-css ^5.1.0
  • jest ^28.1.3
  • jest-environment-jsdom ^28.1.3
  • mitata ^0.1.6
  • react ^18.2.0
  • react-dom ^18.2.0
  • react-router-dom ^6.3.0
  • sirv-cli ^2.0.2
  • size-limit ^8.0.1
  • ts-jest ^28.0.8
  • type-coverage ^2.22.0
  • typescript ^4.7.4
  • node ^12.20.0 || ^14.18.0 || >=16.0.0
  • pnpm 7.9.3
nvm
.nvmrc

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.