0

大多数时候,我们只是从数据库中获取结果,然后将其保存在缓存服务器中,并带有过期时间。

我们什么时候需要持久化该键/值对,这样做的显着好处是什么?

4

2 回答 2

0

Use a key/value database when you are using a key/value cache and you don't need a sql database.

When you use memcached/mysql or similar, you need to write two sets of data access code - one for getting objects from the cache, and another from the database. If the cache is your database, you only need the one method, and it is usually simpler code.

You do lose some functionality by not using SQL, but in a lot of cases you don't need it. Only the worst applications actually leave constraint checking to the database. Ad-hoc queries become impractical at scale. The occasional lost or inconsistent record simply doesn't matter if you are working with tweets rather than financial data. How do you justify the added complexity of using a SQL database?

于 2010-04-18T00:51:16.970 回答
0

如果您需要持久化数据,那么您将需要一个键/值数据库。特别是,作为 NoSQL 运动的一部分,许多人建议用键/值对数据库替换传统的 SQL 数据库——但最终,选择哪种范式更适合您的应用程序仍然是您的选择。

于 2010-04-09T16:17:52.523 回答