The previous array with Ehcache do cache cluster, now the end, so sorted out the comments of the configuration file, some of their own translation, English proficiency is poor, only for reference.
Class= "Net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"Properties= "Connect=tcp (start_port=7800):Tcpping (initial_hosts=127.0.0.1[7800];p ort_range=10;timeout=3000;num_initial_members=3;up_thread=true;down_ Thread=true):Verify_s
A: Detailed configuration steps
1. Add Ehcache.xml File
Add the Ehcache.xml file to the SRC path. Ehcache.xml file contents are as follows
2. Add Spring configuration file
Add in the Appliccontext.xml file
Two: Use
1, defining the Ehcache tool method
public class EHCache {
private static final CacheManager CacheManager = new CacheManager ();
Private cache cache;
Public Ehcacheservice ()
Spring4.1.3 + SpringMVC + Mybatis1.2.3 + Ehcache + shiro + Poi + Easyui1.4.1 framework management system, springmvcehcache
Spring4.1.3 + SpringMVC + Mybatis1.2.3 + Ehcache + shiro + Poi + Easyui1.4.1 framework Management System
Do not say anything. I like this sentence most: there is a picture with the truth
Currently, the project is being updated every day in the past three weeks.
In view of the efficiency and pressure on the database, using caching or memory caching can improve the reaction speed and reduce the database pressure. Hibernate support in the more, in hibernate to the document "Improve Performance" section has detailed description:
Hibernate supports caching types and introductions:
The back three also support the cluster, more powerful.
Now detailed introduction E
First, you need to add a jar package: Ehcache-core-2.6.11.jar and Slf4j-api-1.7.21.jar
Add a ehcache.xml configuration file under the class loading path with the following file contents:
Defaultcache maxelementsinmemory= "10000"Eternal= "false"Timetoidleseconds= "120"Timetoliveseconds= "120"Maxelementsondisk= "10000000"Diskexpirythreadintervalseconds= "120"Memorystoreevictionpolicy= "LRU"/> maxelementsinmemory= "10000"Eternal= "false"Overflow
Shiro is integrated with spring and has been reported another unnamed CacheManager already exists in the same VM. Provide unique names for each cachemanager in the config or do one of the following:1. Use one of the cachemanager.create () static factory methods to reuse same CacheManager with same name or create one if Necessary2. Shutdown the earlier CacheManager before creating new one with same name.The source of the existing CacheManager is:inputstreamconfigurationsource [[email protected]]W
Using Ehache to cache, you can log on to the authentication after the successful authentication authorization and permission information, but when the user exits, the user's corresponding permissions information can not be updated in real-time, so that the user will be able to exit the system to clean up their corresponding permissions information cache.In configuring the Ehcache cache we configured the Myshirocache and specified the name of the permi
Ehcache jar Package: Http://ehcache.org/downloads/catalog Here is the Ehcache Web package. Add a filter to the project's Web. xml file: Create a new Ehcache.xml file in src: OK, so the index.jsp is cached. In addition, caching techniques should not be used for pages that are frequently updated.Ehcache Page Caching Technology
An exception occurred while configuring the cache in the Spring project:Org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:Line 1 in XML document from file [D:\workspaces \eclipse_svn\newsportalproject\webcontent\web-inf\classes\config\ehcache.xml] is invalid; Nested exception is org.xml.sax.saxparseexception:cvc-elt.1:cannot find the declaration of element ' Ehcache '.is caused by omitting the namespace statement in the configurati
Blockingcache is an extension to Ehcache, Blockingcache has a built-in read-write lock that does not require user display calls.To thoroughly analyze the principle of blockingcache, you need to first look at some of the classes it uses internally. Public Interface Cachelockprovider { /* * * * Gets the Sync Stripe to use for a given key. * */ Sync Getsyncforkey (Object key);}Ehcache Blockingc
The project uses Ehcache as a buffer between the program and the database, the cache object is modified during use, such as Plan.setlangsymbol (), where the cache is used, and the data taken is modified, so the guess is caused by a shallow reference to the cache.In fact, StackOverflow also mentions this issueCache.get () returns deep copy of element? 》As for how to do deep Copy,stackoverflow also mentions theCopying cached map, after experimentation,
These two days in the integration of Ehcache with SPRINGMVC, all the things are configured to complete, found that @cacheable this service on the note is not at all, so, with JUnit test DAO found on the DAO @cacheable is so , and did not test the service because it must also be useful. This must be SPRINGMVC a configuration file out of the problem, from Web. Xml to Context.xml, and finally found that the annotation scan package in Spring-mvc.xml We
. Interface (interface verification, text reply, texts reply, etc.) 15.java Timer (timed to execute a program, accurate to seconds, can set cycle) 16.Lucene Full-Text Search (Hibernate version) 17.Quartz (in hibernate version) 18.base64 Transferring Pictures 19. Watermark (Image watermark, text watermark ) 20. Generate or parse two-dimensional code 21.HTML5 + Java EE WebSocket Communication technology 22. Batch asynchronous upload pictures, can preview, there is a progress bar, support drag-and-
When a project has been used for a long time, there will be a variety of problems, the following is the problem I encountered a permission validation errorMy project is Ehcache combined with Shiro, the project used for a long time to appear token validation errors, cookies and the like ... Browser Access appears 500All kinds of WonderfulMy practice is to clear Google Chrome's cookies, and the automatic form fill functionWhen you find a deployment proj
Object caching is to add the query data to the cache, the next time you query again directly from the cache, rather than go to the database query.Object caching is generally for methods, classes, and the combination of spring's AOP objects, method caching is simple. There is a need for cutting programming, using spring Methodinterceptor or using @aspect.The code is as follows: PackageCom.hoo.common.ehcache;Importjava.io.Serializable;ImportNet.sf.ehcache.Cache;Importnet.sf.ehcache.Element;ImportO
The following code test found that the two accounted for almost 500,000 data inserted into the HashMap memory 114MB, and the use of Ehcache, and the device has a memory data size of 10, occupy the memory of 98MB, the following is the test code.
1.HASHMAP Test Code
Import Java.util.HashMap;
Import Java.util.Map; public class Test {public static void main (string[] args) {System.out.println (Runtime.getruntime (). Totalmem
Ory ()-runtime.getru
First download the correlation package in http://code.google.com/p/ehcache-spring-annotations/downloads/list. Import the project. Here is a more detailed introduction can be consulted.
In addition to the jar in the downloaded association package, Spring-context-support.jar, Cblib-2.2.jar is also required.
To configure spring:
Configuration Ehcache:
OK, how to use:
@Cacheable (cachename= "Metacolumnc
In the case of high concurrency, when using the Ehcache cache, the data we read may be wrong due to concurrent reads and writes, and the data we write may be accidentally overwritten. Fortunately, Ehcache provided us with a read (read)/write (write) lock for the cache element key. The read lock on key can be held by multiple threads at the same time, but until those threads have freed the read lock, the oth
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.