-
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.
Merge pull request #511 from techcomrade/feature/redis
Feature/redis
- Loading branch information
Showing
16 changed files
with
213 additions
and
79 deletions.
There are no files selected for viewing
Empty file.
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
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 |
---|---|---|
@@ -1,12 +1,27 @@ | ||
const { createClient} = require("redis"); | ||
const client = createClient(); | ||
|
||
client.on('connect', () => { | ||
console.log('Redis connected'); | ||
}) | ||
client.on('error', err => { | ||
console.log('Redis client error', err); | ||
}) | ||
client.connect(); | ||
|
||
module.exports = client; | ||
const redis = require('redis'); | ||
|
||
const client = redis.createClient({ | ||
socket: { | ||
port: 6380, | ||
host: '127.0.0.1' | ||
} | ||
}); | ||
|
||
client.on('error', (err) => { | ||
console.error('Redis client error', err); | ||
}); | ||
|
||
async function connectRedis() { | ||
try { | ||
await client.connect(); | ||
console.log('Redis connected'); | ||
const pong = await client.ping(); | ||
console.log(pong); | ||
} catch (err) { | ||
console.error('Connection error:', err); | ||
} | ||
} | ||
|
||
connectRedis(); | ||
|
||
module.exports = client; |
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
Oops, something went wrong.