简体   繁体   English

Ehcache,Redis和Gemfire哪个缓存哪个场景?

[英]Ehcache, Redis and Gemfire which Cache for which Scenario?

Grails provides three extended cache plugins: Grails提供了三个扩展缓存插件:

  1. Ehcache 的Ehcache

  2. Redis Cache Redis缓存

  3. Gemfire Cache Gemfire缓存

What are the advantages and disadvantages of these caches and in which scenario should I use which cache? 这些缓存有哪些优点和缺点,我应该在哪种情况下使用哪个缓存?

Redis is a shared data structure, while ehCache is an in-memory storage of serialized data objects. Redis是一种共享数据结构,而ehCache是​​序列化数据对象的内存存储。 Gemfire is similarly to ehCache, but they try to solve the data synchronization issues between multiple machines. Gemfire与ehCache类似,但它们试图解决多台机器之间的数据同步问题。 So an in-memory data system used in the distributed environments. 因此,在分布式环境中使用的内存数据系统。

So it depends. 所以这取决于。 Is your software scaled to multiple machines then ehCache is not be the best option, since you will have to worry about cache invalidation on all machines (and to have the same version of data on every machine). 您的软件是否扩展到多台计算机,那么ehCache不是最佳选择,因为您将不得不担心所有计算机上的缓存失效(并且每台计算机上都有相同版本的数据)。

Do you need more than just caching? 你需要的不仅仅是缓存吗? Will software written in multiple languages use your cache? 用多种语言编写的软件会使用您的缓存吗? Then use Redis. 然后使用Redis。 Redis is not just a cache, it can be viewed as a key value storage (database - like) where the data is stored on a machine in the RAM memory, but it can also be flushed to disk (to keep it persistent). Redis不仅仅是一个缓存,它可以被视为一个键值存储(类似于数据库),其中数据存储在RAM内存中的机器上,但它也可以刷新到磁盘(以保持持久性)。

In Redis you can query data, you can create great counters, send batch transactions. 在Redis中,您可以查询数据,可以创建出色的计数器,发送批量事务。 check here for more info: http://redis.io/topics/introduction 点击此处查看更多信息: http//redis.io/topics/introduction

Between all 3, I would personally pick redis (for large distributed software) and ehCache when I just need a simple, quick in memory cache. 在所有3个之间,当我只需要一个简单,快速的内存缓存时,我会亲自选择redis(对于大型分布式软件)和ehCache。 These 2 have great communities behind them and you will find answers to whatever issues you encounter. 这2个人拥有很好的社区,你会找到你遇到的任何问题的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM