PrefaceA period of time in the work used to encache, in fact, the work inside Encache and memcache are in use, the opportunity to simply learn, but also share with you the cache related knowledge. This article mainly introduces the Encache briefly.
The
ChaseI. IntroductionEhCache is a pure Java in-process caching framework, which is fast and capable, and is the default Cacheprovider in Hibernate. Ehcache is a widely used, open source Java distributed cache. Primarily for general purpose caches, Java EE and lightweight containers. It features memory and disk storage, cache loaders, cache extensions, cache exception handlers, a gzip cache servlet filter, and support for rest and soap APIs. The following is the official website explanation:Ehcache is a open source, standards-based cache for boosting performance, offloading your database, and simplifying s Calability. It's the most widely-used java-based cache because it ' s robust, proven, and full-featured. Ehcache scales from in-process, with one or more nodes, all the same to mixed in-process/out-of-process configurations with Terabyte-sized caches.
two. FeaturesThe main features are:1. Fast2. Simple3. Multiple Cache Policies4. Cache data has two levels: memory and disk, so there is no need to worry about capacity issues5. Cache data is written to disk during virtual machine restart6. Distributed caching can be done via RMI, pluggable APIs, etc.7. Listening interface with cache and cache manager8. Support multiple cache manager instances, and more than one instance of the cache area9. Provide hibernate cache implementation
three. Simple to usethe approximate steps to create and manage the cache using CacheManager are:First step: Generate CacheManager ObjectsStep Two: Generate the Cache objectStep Three: add element elements of a key-value pair composed of Key,value to the cache objectFourth step: Turn off CacheManager.
There are 4 ways of creating CacheManager:method One: Create with default profileEhcache has the default configuration file Ehcache.xml, which has a default configuration and a default cache. mode Two: Create with the specified profile
method Three: Find the configuration file from Classpath and create
Mode four: Create via input stream
Introduction to the Encache cache