mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-01-25 14:42:47 +00:00
update
This commit is contained in:
parent
b3d9d37209
commit
de416e5f33
@ -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);
|
||||
},
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user