typeorm-cache
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

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

Package Sidebar

Install

npm i typeorm-cache

Weekly Downloads

1,182

Version

1.1.3

License

MIT

Unpacked Size

11.3 kB

Total Files

8

Last publish

Collaborators

  • acathur