开发者

Grails 1.3.1: Improved Query Caching

http://www.grails.org/1.3.1+Release+Notes

Improved Query Caching

The findAll query method now supports taking advantage of the 2nd level cache.

Book.findAll("from Book as b where b.author=:author", [author:'Dan Brown'], [cache: true])

What advantages or disadvantages of usi开发者_JS百科ng 2nd level cache ?

I'm developing web-server for iPhone application so i have a lot of parallel connections, DB queries, etc.


Generally, the 2nd level cache holds the application data previously retrieved from the database. The advantage is that you can make big savings on avoiding database calls for the same data. If 2nd level cache is going to be efficient or not depends on how your app is working with the data and also on the size of the data you can store in memory. Probably the only major disadvantage is that cache need to be invalidated when data is updated in the database. When that happens from your application, some frameworks can handle that automatically (e.g. write trough cache), but if database is changed externally you can only rely on the cace expiration.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜