turn on query caching) is simple with spring's AOP annotations, whereas in other query methods The main use is Ehcache, which caches the various objects returned by the method. Open Hibernate query cache and level two cache is relatively simple, here do not introduce too much, we mainly look at the use of Ehcache.1. First we use Interceptor, which defines two interceptors methodcacheinterceptor and Methodc
As a result of these two days the SPRINGMVC and MyBatis built web framework is then ready to be cached data, simply record theGet ready:Googlecode's EhcacheThis can be downloaded in the https://code.google.com/p/ehcache-spring-annotations/, downloaded after the use of the jar package Note Pack Ehcache-spring-annotations-1.2.0.jar in the downloaded Compression pack Since some of the other packages are al
Spring boot uses simplecacheconfiguration by default, that is, using Concurrentmapcachemanager to implement caching. But it's easy to switch to another cache implementation. Pom File
Introducing the appropriate jar package in the POM
configuration file
The configuration files required by Ehcache are simply placed under the classpath and Spring boot is automatically scanned.
You can also specify the location of the
roledao.getrole (ID);
}
The application.properties configuration file is as follows
#redis------start-------
spring.redis.hostname=127.0.0.1
spring.redis.port=63791
spring.redis.timeout=1000
spring.redis.maxidle=10
spring.redis.maxwaitmillis=15000
Spring.redis.testonborrow=true
Spring.redis.testwhileidle=false
The Ecache-shiro.xml configuration file is as follows (Shiro is used for this project, so Ehcache uses the Shiro cache profile)
Problems en
1 Ehcache Profile
EhCache is a pure Java in-process caching framework, with fast, lean and so on, is the default Cacheprovider in Hibernate.
Ehcache is a widely used open source Java distributed cache. Mainly for general-purpose caching, Java EE and lightweight containers. It features memory and disk storage, cache loaders, cache extensions, cache exception han
About Class LoadingClass loading, within the plethora of environments that Ehcache can is running, could be complex. but with the Ehcache, all class loading are done in a standard-of-the-utility class:classloaderutil. Plugin Class LoadingEhcache allows plugins for events and distribution. These is loaded and created as follows:/*** Creates a new class instance. Logs errors along the. Classes is loaded * us
EhCache is a pure Java in-process caching framework, which is fast and capable, and is the default Cacheprovider in Hibernate.features of the Ehcache cache:1. Fast. 2. Simple. 3. Multiple caching Strategies 4. There are two levels of cache data: memory and disk, so there is no need to worry about capacity issues 5. The cached data is written to disk 6 during the virtual machine restart. Distributed caching
2.EhCahe is introduced:Mainly divided into three layers, the topmost is CacheManager, it is the entrance of Operation Ehcache. You can get a list of CacheManager by Cachemanager.getinstance () or create a new CacheManager from the CacheManager constructor. Each Cachemanger manages multiple caches. Each cache is associated with multiple element in a hash-like manner. element is where we store the cached content.3. Environment Construction:It's simple
Ehcache IntroductionEhcache is a pure Java in-process caching framework.With the Ehcache caching framework, you can store data in the cache first, with two levels of cache data: memory and disk, so there is no need to worry about capacity issues. The cached data is written to disk during the virtual machine restart. The caching framework is used primarily faster than traditional databases.Ehcache can work w
This will introduce the use of query caching, first-level caching, level two caching in Hibernate, and the integration of spring using query caching in Hibernatetemplate. , here is Hibernate3, using hibernate4 similar, but not hibernatetemplate,DirectQuery query = getsession (). CreateQuery (HQL);Turn on level two cachingQuery.setcacheable (TRUE);Ehcache is one of Hibernate's level two cache technology, can store the query data in memory or disk, save
The following is the second part of the comprehensive anatomy of memcached.
Release Date: 2008/7/9Original link: http://gihyo.jp/dev/feature/01/memcached/0002
Links to this series of articles are here:
1th Time: http://www.phpchina.com/html/29/n-35329.html
2nd time: http://www.phpchina.com/html/30/n-35330.html
3rd time: http://www.phpchina.com/html/31/n-35331.html
4th Time: http://www.phpch
To use Java's local cache, consider using Ehcache, or guava.Guava more high-end, can be automatically timed refresh. I have chosen Ehcache.The Ehcache is integrated in spring. To use Ehcache, you need only the following steps:Of course, you need to first introduce Ehcache-related jar packages. You can use MAVEN depende
what is Ehcache. EhCache is a pure Java in-process cache framework, is a widely used open source Java distributed cache, with fast, capable and so on, is the default Cacheprovider hibernate. Ehcache is a distributed cache framework.
Distributed Cache
Our system to improve the system concurrency, performance, general Distributed system Deployment (cluster deploym
Students interested in memcached and Redis may wish to spend a few minutes reading this article, otherwise please drift over.Why Redis beats Memcached for caching | Why is Redis better than memcached in the context of caching?Memcached is sometimes more efficient, but Redis is almost alwaysthe better choice.XxxMemcache
The second part of memcached comprehensive analysis is as follows.
Posting date: 2008/7/9Link: http://gihyo.jp/dev/feature/01/memcached/0002
Here is the link to this series of articles:
1st times: http://www.phpchina.com/html/29/n-35329.html
2nd times: http://www.phpchina.com/html/30/n-35330.html
3rd Times: http://www.phpchina.com/html/31/n-35331.html
4th times: http://www.phpchina.com/html/32/n-3533
features of the Ehcache cache:1. Fast. 2. Simple. 3. Multiple caching Strategies 4. There are two levels of cache data: memory and disk, so there is no need to worry about capacity issues 5. The cached data is written to disk 6 during the virtual machine restart. Distributed caching can be done through RMI, pluggable APIs, and so on 7. Listening interface with cache and cache manager 8. Supports multi-cache manager instances, and multiple cache zones
Because ehcache is used in the project, the net. sf. ehcache. util. UpdateChecker doCheck will be printed every time tomcat starts.I did not pay special attention to it before. When I started Tomcat today, I found the following output information:{INFO} [07:42:10, 625] R the latest version.Later, the analysis showed that EhCache had to connect to the
1. Scene Restore
Recently, because the project involves the cache of related data, previously also wrote the Redis cache blog; But the author thinks Ehcache is compared with it, the configuration is simple, also easy to get started, so today introduces how to integrate Ehcache in Springboot Project 2. Implementation plan
① Import Ehcache Dependent
② the Spring
Reference: http://www.javaeye.com/topic/99721
There is a need to use spring to implement a simple cache solution with the following requirements: Using any of the existing open source cache frameworks requires that you can return results from a service in the cache system or Get/find in the DAO layer. If the data is updated (using the Create/update/delete method), the corresponding content in the cache is refreshed.Based on the requirements, the plan uses spring AOP +
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.