【问题标题】:What is the impact on performance of localStorage in an Ionic app?对 Ionic 应用程序中 localStorage 的性能有什么影响?
【发布时间】:2016-11-06 04:19:55
【问题描述】:

我正在使用 Ionic 框架开发移动应用程序,并且正在使用 localStorage 进行缓存。我想知道使用 localStorage 是否会对我的应用的性能产生负面影响。

【问题讨论】:

    标签: ionic-framework local-storage angular-local-storage


    【解决方案1】:

    这取决于您的应用程序,您可以使用 localStorage,因为 localstorage 在应用程序开发中起着重要作用,但在某些情况下它会影响应用程序的性能,

    你应该考虑

    • 你应该经常更换localStorage的值,因为一旦你设置了值,除非你改变,否则它不会改变,

    • 如果应用程序需要大数据,你必须选择Sqlite

    • 避免在 localStorage 中存储复杂的数据,因为你不应该在 localStorage 的帮助下玩代码逻辑。

    【讨论】:

      【解决方案2】:

      您可以使用如下代码所示的缓存:

      .state('app.userlist', {
           cache : false,
           url: "/userlist",
                   views: {
                   'menuContent': {
                   templateUrl: "templates/userlist.html",
                   controller: 'UserListCtrl'
           }
       }
      })
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-04-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-01-10
        • 2011-11-24
        • 1970-01-01
        相关资源
        最近更新 更多