Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zinirun/sequelize-redis-caching
Redis caching in CRUD works with Sequelize (MySQL)
https://github.com/zinirun/sequelize-redis-caching
crud nodejs redis sequelize
Last synced: 6 days ago
JSON representation
Redis caching in CRUD works with Sequelize (MySQL)
- Host: GitHub
- URL: https://github.com/zinirun/sequelize-redis-caching
- Owner: zinirun
- Created: 2020-10-28T05:24:13.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-10-28T08:06:22.000Z (about 4 years ago)
- Last Synced: 2024-08-02T20:46:38.231Z (3 months ago)
- Topics: crud, nodejs, redis, sequelize
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sequelize-redis-caching
Redis caching in CRUD with Sequelize (MySQL)Based on this sample, you can refer to appropriate caching when using Sequelize in CRUD work.
## Start
- Clone this git
```bash
$ git clone https://github.com/zinirun/sequelize-redis-caching.git
```
- Define your database(MySQL) at `.env`
```js
DATABASE = "YOUR_DATABASE_NAME"
DB_USER = "YOUR_DATABASE_USER"
DB_PASSWORD = "YOUR_DATABASE_PASSWORD"
DB_HOST = "localhost"
```
- Start express
```bash
$ yarn install # npm install
$ yarn start # npm start
```> You can define your Redis host `redisHost` at `./admin/admin.ctrl.js` (It assumes Redis Client runs as Host Docker by default)
## Caching Position
Controllers are defined at `./admin/admin.ctrl.js`. Cached data is saved as `JSON.stringify` and loaded as `JSON.parse`.- Set Cache from Redis (when C, U, D)
- `post_products_write`
- `post_products_edit`
- `post_products_delete`- Get Cache from Redis (when R)
- `get_products`
- It uses Promisify function `getAsync`
- It accesses Sequelize when redis has no cache