cache.js 533 Bytes
/**
 * 设置cache controller
 * @author: xiaoxiao<xiaoxiao.hao@yoho.cn>
 * @date: 2016/12/21
 */

'use strict';
const cache = global.yoho.cache;

const index = (req, res, next) => {
    let customerServiceSwitch = req.query.customerServiceSwitch;

    if (typeof customerServiceSwitch === 'undefined') {
        res.json(false);
        return;
    }

    cache.set('customerServiceSwitch', customerServiceSwitch ? true : false, -1).then(result => {
        res.json(result);
    }).catch(next);
};

module.exports = {
    index
};