typeorm-cache

A typeorm cache provider based on keyv.

Usage no npm install needed!

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

README

Typeorm Cache

A typeorm cache provider based on keyv.

Installation

# npm
npm i typeorm-cache keyv --save

# or yarn
yarn add typeorm-cache keyv

Usage

import { createConnection } from 'typeorm'
import { KeyvCacheProvider } from 'typeorm-cache'

// In-memory cache
createConnection({
  // ... db config
  cache: {
    provider() {
      return new KeyvCacheProvider()
    }
  }
})

// Redis
createConnection({
  // ... db config
  cache: {
    provider() {
      return new KeyvCacheProvider('redis://user:pass@localhost:6379')
    }
  }
})

// ...

For more examples, visit keyv documentation.

License

MIT

Copyright (c) 2021, Acathur