本地数据库缓存的最佳实践? [英] Best practice for a local database cache?

查看:127
本文介绍了本地数据库缓存的最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个依赖于MySQL数据库的部分内容的应用程序.在某些情况下,该应用程序将在Internet连接(UMTS)受限的环境中运行,尤其是延迟时间较长的情况.

I am working on an application that depends on a MySQL database for parts of the content. In some cases, the application will run in an environment with limited internet connectivity (UMTS), in particular suffering from high latencies.

应用程序的用户能够登录,并且该应用程序的用户界面的大部分内容都是从MySQL数据库中检索到的.为了防止用户登录后的延迟,我想在客户端尽可能多地缓存数据库内容.只有在进行了相关更改的情况下,才应从数据库中检索新内容.是否有解决此问题的常用方法?有没有描述该问题的可靠解决方案的文献?

A user of the application is able to login, and most of the content for the user interface of the application is retrieved from a MySQL database. To prevent delays after a user logs in, I would like to cache as much of the database content at the client side as possible. New content should only be retrieved from the database in case a relevant change was made. Is there a common way to approach this problem? Any literature that describes solid solutions to this problem?

小更新:我现在正在研究CouchDB作为我的特定用例的解决方案.主要原因是:

Small update: I am now looking into CouchDB as the solution for my particular use-case. The main reason being that:

它允许用户和服务器在断开连接时访问和更新相同的共享数据,然后在以后双向复制这些更改.

it allows for users and servers to access and update the same shared data while disconnected and then bi-directionally replicate those changes later.

(来自: http://couchdb.apache.org/docs/overview.html )

到目前为止,它看起来非常有前途.

So far it looks really promising.

推荐答案

我们实际上是在运行数据库的本地副本,并且大多数软件只与始终可用的本地数据库通信.然后,我们有一个后台过程,可以使两个数据库保持同步.

We actually run a local copy of the database and have most of the software just talk to the local database which is always available. Then we have a background process that works to keep the two databases in sync.

我会警告您,任何类型的本地缓存都不适合胆小的人.它有许多不同步的方法.如果可以,请避免这样做.

I will warn you that any type of local caching is not for the faint of heart. There are soooo many ways it can get out of sync. Avoid doing it if you can.

这篇关于本地数据库缓存的最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆