Skip to content

Theo-/sequelize-turbo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sequelize Turbo

Turbo is a caching layer that is eventually consistent for FAUW (Frequent access, unfrequent writes) objects.

How to install

1. Add the package

npm install sequelize-turbo --save
yarn add --save

2. Wrap objects

Whenever you create Sequelize objects in your code, wrap them as follow:

const Turbo = require('sequelize-turbo')

const User = Turbo(
    sequelize.define('User', {
        ...config
    })
)

export default User

That's it! Turbo uses RAM to cache objects. However, is a distributed environment, using Redis is much more efficient.

How does it work

Turbo adds decoratos on top of the usual sequelize functions find, update, destroy and insert. Using a dependency cache, Turbo can figure out when to invalidate objects and when to cache them.

Turbo guarantees freshness of the objects, you will never get outdated objects.

Debug

Set the following environment variable to debug Turbo: DEBUG=turbo:*

About

Abstraction layer for FAUW-type objects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published