【问题标题】:angular-cache doesn't clear local storage cache when using DSCacheFactory.destroyAll or clearAll使用 DSCacheFactory.destroyAll 或 clearAll 时,角度缓存不会清除本地存储缓存
【发布时间】:2015-06-03 15:09:29
【问题描述】:

我将 angular-cache 用于 localStorage 功能。但是,我发现当尝试销毁或清空我的所有缓存时,似乎只清除了内存中的缓存,而不是 localStorage 缓存。我怎样才能清除两个缓存?

【问题讨论】:

    标签: javascript angularjs caching angular-cache


    【解决方案1】:

    我提交了一份错误报告。同时,我在调用 DSCacheFactory.destroyAll() 后立即实现了这段代码:

    for(var i in $window.localStorage){
        if(i.indexOf("angular-cache.caches")>-1){
          $window.localStorage.removeItem(i);
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-31
      • 1970-01-01
      相关资源
      最近更新 更多