-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added redis to cache large queries (#190)
feat: added redis to cache alrge queries
- Loading branch information
Showing
5 changed files
with
216 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { REDIS } from '../config/env.js'; | ||
import Redis from 'ioredis'; | ||
import logger from './logger.js'; | ||
import Chad from './chad.js'; | ||
|
||
const client = new Redis({ | ||
port: REDIS.port, // Redis port | ||
host: REDIS.host, // Redis host | ||
username: REDIS.username, // needs Redis >= 6 | ||
password: REDIS.password, | ||
db: REDIS.db, // Defaults to 0 | ||
}); | ||
|
||
client.on('error', (error) => { | ||
logger.error(e); | ||
Chad.flex(e.message, e.stack); | ||
}); | ||
|
||
client.on('error', (error) => { | ||
logger.info(`Redis client started`); | ||
}); | ||
|
||
export default client; |