Java开源缓存框架介绍(OSCache,JSC)
OSCache是个一个广泛采用的高性能的J2EE缓存框架,OSCache能用于任何Java应用程序的普通的缓存解决方案。
有一个疑惑。就是JAVA缓存框架与memcache有什么区别呢?我把所有数据查询出来放在memcache里面不行么?比如说oscache与memcache适用场合有什么区别呢?
天蓬老师2017-04-17 13:32:08
OSCache has not been updated for a long time. It is recommended to read the official documentation of EHCache.
There are obvious differences betweenehcache, a jvm cache, and memcache, a io-level cache. The following differences determine their use in different scenarios. 优点
: It will be more efficient without IO overhead and more flexible to use. 缺点
: However, the public jvm memory will also have an impact on the application itself, and it will be more difficult to share it with multiple applications. (ehcache has a solution that does not use jvm memory)
伊谢尔伦2017-04-17 13:32:08
OSCache or EHCache, the main application scenarios are mostly in-application caching. That is the cache used in my program. All caches are in this program written by myself.
Memcache is an independent process and an independent cache. The cached data is saved in the memory of another process. In my opinion, there are two differences:
天蓬老师2017-04-17 13:32:08
Personally, I feel that memcache is similar to a container for objects. It only provides simple functions of putting objects in and removing objects. It can be imagined as a Map.
OSCache is encapsulated on the basis of this kind of object container, providing more powerful functions. It can realize automatic caching of some content through simple configuration files. However, using memcache directly requires writing a lot of additional caching logic and strategy code. .
大家讲道理2017-04-17 13:32:08
Using caching, for example, caching some fixed master data, it is very easy to improve website performance by 5-10 times. We use EHCache to easily improve the performance of a course selection system by 7-8 times.
When using cache, the most troublesome thing is dealing with data synchronization. For example, with a redis cache server and a mysql server, you can write data to two databases at the same time, but there will be problems with transaction processing. Cache synchronization is still quite troublesome
PHP中文网2017-04-17 13:32:08
OSCache or EHCache is a JVM cache. It cannot be shared by multiple applications or your cluster. This will cause a waste of memory and is suitable for small applications that do not require a cluster. Memcache is an independent cache that can be shared by a cluster or multiple applications. It is suitable for larger applications.
PHP中文网2017-04-17 13:32:08
OSCache or EHCache are often used for server local cache. If used directly, it can only be accessed by a single application process. If multiple processes are opened or multiple servers are deployed, each process can only access the local cache. If caching is needed Synchronization requires writing relevant synchronization code. ehcache also supports distributed caching of RMI, JGroups, and JMS, so there is no need to write synchronization code by hand. You can also build a separate EhCache Server, which is almost the same as memcache.
The memcache cache is a separate process. The advantage is that there is less cache synchronization between processes, because there is only one copy of the data on memcache, instead of ehcache having one copy on each process; but access requires inter-process communication, which is more communication overhead.