typeorm-cache
v1.1.3
Published
A typeorm cache provider based on keyv.
Downloads
5,509
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
Copyright (c) 2021, Acathur