code is formatted, comprehensive comments, beautiful and easy to read.11, detailed record system operation log, help the operation and maintenance personnel for system analysis and troubleshooting.12, using Ehcache two cache, Spring MVC static load cache and other mechanisms to improve system performance.13, the data persistence layer is divided into hibernate and MyBatis two big architectures. 2 sets of systems, in addition to the data persistence l
The Ehcache distributed cache used in the original project has the disadvantage of wasting memory and Ehcache using the memory of the JVM process, so memory usage is restricted.There is a scenario in the business where you sometimes want to update a business entity to invalidate the corresponding cache, in which case the update cache can only be one of the updated entities if the corresponding business enti
First, ehcache.xml configuration detailedStand-alone configuration:Mandatory Default Cache configuration. These settings'll be applied to cachesCreated programmtically using Cachemanager.add (String cachename)-Name: Cache names.Maxelementsinmemory: Maximum number of caches.Eternal: The object is permanently valid, but if set, timeout will not work.Timetoidleseconds: Sets the allowable idle time (in seconds) for an object before it expires. An optional property is used only if the Eternal=false o
A The extremely simple research summarizes the Web caching mechanism: Mamcache and Ehcache and terracotta:
After I mamcache:google, I found that more of the current uses are: Memcached Client for Java and spymemcached, and xmemcached, but in practice the Maven Jar Library was found to have no Mcached Client for Java support. The principle may be different, but it's not very complicated to use,
1. memcached Client for Java:
It can set a lot of paramete
Reproduced in: http://www.16boke.com
Ehcache is a good caching framework, the introduction of Ehcache has been a lot of online, here to share a ehcache in the actual project use examples:
[Java] View Plain copy packagecom.avic.smartb.utils; /** * * @className:ehcacheconfig.java * */ publicclassehcacheconfig{ /** * maximum number of elements */ publicstati
returns the same instance of the cached object to all callers. Therefore, these objects cannot be modified. This provides a very important performance advantage. A writable cache returns a copy of the cached object (via serialization). This is slower, but safe, so the default is false.
2.Mybatis Add Ehcache
MyBatis Add Third-party Cache component support You only need to add a row to the SQL mapping file:
Of course, you can choose to
1.Overview
Ehcache from the Hibernate development, and gradually covers the entire function of the CAHCE, is currently the best development momentum of a project.
Standard cache
Distributed caching (based on RMI/JGROUPS/JMS)
URL, page fragment cache (similar to oscache related parts)
Central cache server (similar to memcached)
2. Basic function and Configuration
The basic functions of ehcache can be
Ehcache is a cache management class library that uses Java to implement complex and high-speed thread-safe usage. ehcache provides memory and disk file storage, as well as a variety of sensitive cache management solutions such as the distributed storage architecture. At the same time, ehcache is openSource codeThe project adopts the relatively loose Apache licens
How to persist data to disk when using Ehcache, and do not lose data after the application server restarts1. How to persist to diskWith Cache.flush (), Cache.flush () is called after each write to the cache, so that Ehcache writes the index (XXX.INDEX) back to disk. This allows the cache to be lost without worrying about whether or not the program exits abnormally.2, attach the configuration file modificati
Ehcache IntroductionEhcache is a very good, lightweight, local caching scheme that can solve the fast saving and accessing of static resources in large concurrency situations.Introducing the Ehcache jar packageThe latest version of the Ehcache jar package is introduced here:dependency> groupId>net.sf.ehcachegroupId> artifactId>ehcacheartifactId> version>
= "+"Memorystoreevictionpolicy= "LRU" /> Ehcache>Ehcache.xml and other configuration filesIn previous versions of Ehcache-1.6, only ASCII-encoded ehcache.xml profiles were supported. In later versions of Ehcach-1.6, the UTF8 encoded ehcache.xml configuration file is supported. Because of backwards compatibility, all the ASCII-encoded profiles are completely unnecessary to convert to UTF8.A cache
1 . 1mybatis and Ehcache Cache framework consolidation generally does not use MyBatis to manage caches, but uses other caching frameworks to manage caches, because other cache frameworks manage caching more efficiently because others specialize in caching and mybatis specialized in SQL statements, The MyBatis level two cache maintains cached data through Ehcache. 1.1. 1 Distribution Cache distributes the c
The so-called cache, is the program or the system will often call the object in memory, so that it can be used to quickly call, do not have to create new duplicate instances. This can reduce system overhead and improve system efficiency.
Caching can be divided into two major categories:
First, through file caching, as the name implies file caching refers to the storage of data on disk, whether you are in XML format, serialized file dat format or other file format;
Second, the memory cache, that
(1) First need to need two main jar package
Ehcache-core-2.4.6.jar
Mybatis-ehcache-1.0.1.jar Ehcache-core must have more than 1.3 versions since 1.3 didn't seem to support the cluster.(2) Create a ehcache.xml under the Classpath
Above the Diskstor path you can specify a path, Java.io.tmpdir refers to your system's cache directory, you can Baidu and then general
user's query
One complete SHiro Integration EHcacheCache Permission Datahint: introduce Ehcache dependency, provide ehcache core configuration file, configure Cache Manager object and inject to Security Manager objectOperation Steps:
introducing The coordinates of Ehcache in Pom.xml
provides core configuration files for
ObjectiveIn the extensive use of Java projects. It is an open source, designed to increase the high cost of data removed from the RDBMS, high latency to take a caching scheme.Just because Ehcache is robust (Java-based development), certified (with Apache 2.0 license), full of features (detailed later),So it is used in the various nodes of the large complex distributed Web application.features1, fast enoughEhcache's release has been a long time, after
PDF Official Document: Http://www.ehcache.org/generated/2.10.4/pdf/About_Ehcache.pdf1. What is Ehcache?Ehcache is an open-source, standards-based cache that improves performance and reduces database load, and is the most widely used Java-based cache today.2. Basic terminology
cache: The wiki defines the cache as "storage of what is going to be used and can be retrieved quickly". A cache is a set of
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.