Cache和Session的rm方法都返回Promise

This commit is contained in:
welefen 2014-06-01 13:58:10 +08:00
parent 2e079eb35a
commit 5bd488d116
4 changed files with 9 additions and 2 deletions

View File

@ -106,8 +106,13 @@ module.exports = Cache(function(){
rm: function(name){
var filePath = this.getStoredFile(name);
if (isFile(filePath)) {
fs.unlink(filePath, function(){});
var deferred = getDefer();
fs.unlink(filePath, function(){
deferred.resolve();
})
return deferred.promise;
}
return getPromise();
},
/**
* gc

View File

@ -88,6 +88,7 @@ module.exports = Cache(function(){
if (this.data) {
delete this.data[name];
}
return getPromise();
},
/**
* 将数据保存到数据库中

View File

@ -118,6 +118,7 @@ module.exports = Class(function(){
if (key in this.cacheData) {
delete this.cacheData[key].data[name];
}
return getPromise();
},
/**
* gc

View File

@ -1,7 +1,7 @@
{
"name": "thinkjs",
"description": "A MVC Web Framework For Node.js",
"version": "0.5.28",
"version": "0.5.29",
"author": {
"name": "welefen",
"email": "welefen@gmail.com"