Skip to content

simple caching system built for funzies, .ts .spec.ts webpack.config.js

Notifications You must be signed in to change notification settings

john-ko/simple-cache

Repository files navigation

Simple cache

built for funzies

  • typescript
  • webpack
  • jest

todo

  • change to promise based cache values

usage

generic

// ttl options in minutes
const simpleCache = new SimpleCache({ ttl: 30 })

simpleCache.set('key', 'value')
const value = simpleCache.get('key') // 'value'

fetch

const axios = require('axios')
const fetch = () => { return axios.get('/users/john') }
const simpleCache = new SimpleCache({ ttl: 60 })

const value = await simpleCache.fetch('/users/john', fetch)

About

simple caching system built for funzies, .ts .spec.ts webpack.config.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published