mirror of https://github.com/requarks/wiki
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
509 B
30 lines
509 B
7 years ago
|
'use strict'
|
||
|
|
||
|
/* global wiki */
|
||
|
|
||
|
const Redis = require('ioredis')
|
||
|
const { isPlainObject } = require('lodash')
|
||
|
|
||
|
/**
|
||
|
* Redis module
|
||
|
*
|
||
|
* @return {Object} Redis client wrapper instance
|
||
|
*/
|
||
|
module.exports = {
|
||
|
|
||
|
/**
|
||
|
* Initialize Redis client
|
||
|
*
|
||
|
* @return {Object} Redis client instance
|
||
|
*/
|
||
|
init() {
|
||
|
if (isPlainObject(wiki.config.redis)) {
|
||
|
return new Redis(wiki.config.redis)
|
||
|
} else {
|
||
|
wiki.logger.error('Invalid Redis configuration!')
|
||
|
process.exit(1)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|