1234567891011121314151617181920212223242526272829303132333435363738394041 |
- /**
- * REIDS键值对模型基类。
- *
- * 模型,提供事件抽象。
- *
- * author:linz
- * since: 2016.12.13
- */
- "use strict";
- const RedisKeys = require('../include/commons').REDIS_KEYS;
- const RedisSessionKey = require('../include/commons').REDIS_SESSION_KEY;
- let sessionKey =RedisSessionKey;
- class RedisModel{
- constructor() {
- this._RedisModelKey= RedisKeys;
- this._setSessionKey = function(key){
- for (let modelKey in RedisKeys){
- let value = RedisKeys[modelKey];
- if(value.indexOf(RedisSessionKey)>=0){
- this._RedisModelKey[modelKey] = value.replace(RedisSessionKey,key);
- }
- }
- };
- //根据redis的key获取单个rediskey的值
- this._getKey = function(redisKey,keyModel,keyValue){
- let _key = RedisKeys[redisKey];
- if(_key.indexOf(keyModel)>=0){
- _key.replace(keyModel,keyValue);
- }
- return _key;
- }
- }
- get getRedisModelKey(){
- return this._RedisModelKey;
- }
- }
- module.exports = RedisModel;
|