mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-01-25 14:42:47 +00:00
修复FileSession下存多个值会把前面的值冲掉的问题
This commit is contained in:
parent
334bd0ac54
commit
6b3dde648e
@ -41,7 +41,7 @@ module.exports = Cache(function(){
|
||||
if (!exists) {
|
||||
return deferred.resolve();
|
||||
}
|
||||
fs.readFile(filePath, function(error, content){
|
||||
fs.readFile(filePath, {encoding: "utf8"}, function(error, content){
|
||||
if (error || !content) {
|
||||
return deferred.resolve();
|
||||
}
|
||||
@ -83,8 +83,11 @@ module.exports = Cache(function(){
|
||||
expire: Date.now() + timeout * 1000,
|
||||
timeout: timeout
|
||||
};
|
||||
setFileContent(filePath, JSON.stringify(data));
|
||||
return getPromise();
|
||||
var deferred = getDefer();
|
||||
fs.writeFile(filePath, JSON.stringify(data), function(){
|
||||
deferred.resolve();
|
||||
})
|
||||
return deferred.promise;
|
||||
},
|
||||
/**
|
||||
* 设置缓存
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thinkjs",
|
||||
"description": "A MVC Web Framework For Node.js",
|
||||
"version": "0.5.27",
|
||||
"version": "0.5.28",
|
||||
"author": {
|
||||
"name": "welefen",
|
||||
"email": "welefen@gmail.com"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user