From de416e5f33f3f2ec493d1a73623f361fb5d95986 Mon Sep 17 00:00:00 2001 From: welefen Date: Wed, 23 Apr 2014 19:38:26 +0800 Subject: [PATCH] update --- lib/Lib/Core/Controller.js | 3 +-- lib/Lib/Core/Db.js | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Lib/Core/Controller.js b/lib/Lib/Core/Controller.js index 8777331a..60560ffe 100644 --- a/lib/Lib/Core/Controller.js +++ b/lib/Lib/Core/Controller.js @@ -182,8 +182,7 @@ module.exports = Class(function() { return instance.rm(); } if (value !== undefined) { - instance.set(name, value); - return this; + return instance.set(name, value); } return instance.get(name); }, diff --git a/lib/Lib/Core/Db.js b/lib/Lib/Core/Db.js index c17e5cdd..b2d79332 100644 --- a/lib/Lib/Core/Db.js +++ b/lib/Lib/Core/Db.js @@ -661,16 +661,17 @@ var Db = module.exports = Class(function(){ cache = options.cache; } var self = this; + var cacheOn = !isEmpty(cache) && C('db_cache_on'); //获取数据 function queryData(){ return self.query(sql).then(function(data){ - if (cache) { + if (cacheOn) { S(key, data, cache); } return data; }); } - if (!isEmpty(cache) && C('db_cache_on')) { + if (cacheOn) { var key = isString(cache.key) && cache.key ? cache.key : md5(sql); return S(key, undefined, cache).then(function(value){ return value || queryData();