微风:如何判断返回的查询是从本地缓存还是远程服务器



我知道您可以调用这个函数进行本地查询,如果可能的话,也可以远程查询。是否有一种方法来判断结果是来自本地还是远程?我记得我读过一些关于它的东西,但是再也找不到了。

manager.fetchEntityByKey('Employee', employeeID, true)
       .then(function(data) {
            employee(data.entity); 
       });

在promise结果上使用' fromache '布尔属性

manager.fetchEntityByKey('Employee', employeeID, true).then(function(data) {
   var employee = data.entity
   var wasFoundInCache = data.fromCache; 
});

见:http://www.breezejs.com/sites/all/apidocs/classes/EntityManager.html method_fetchEntityByKey

最新更新