Ehcache (2) Getting Started Guide

Source: Internet
Author: User

Getting started http://blog.csdn.net/mgoann/archive/2009/04/16/4083962.aspx

Ehcache getting started

Introduction

Ehcache can be used directly. It can also be used in combination with the hibernate object/link framework. You can also perform servlet caching.

General Cache

· Ensure that JDK supports your existing ehcache versions. ehcache supports jdk1.4, 1.5, and 1.6.

· Add the ehcache jar package to your classpath environment variable.

· The class libraries on which ehcache depends are added to your classpath environment variables. Different Versions of ehcache depend on different class libraries. Note that the ehcache versions and related dependent class libraries are not described here. For details, refer

Http://ehcache.sourceforge.net/documentation/dependencies.html

· Configure the ehcache. xml configuration file and add it to classpath.

· Configure logging to the appropriate level.

Hibernate

· Refer to the general cache procedure.

· Create a cache in ehcache. xml.

Java EE ServletCache

· Refer to general cache steps.

· Configure cache for your web page in ehcache. xml.

· To Cache all pages, you can use simplepagecachingfilter provided by ehcache or write a subclass to inherit the cachingfilter.

· To Cache a specific JSP page (including the page returned by requestdispatcher), you can use simplepagefragmentcachingfilter provided by ehcache or write a subclass to inherit pagefragmentcachingfilter.

· Configure web. xml. Here it is relatively simple, Just configure the filter you used in the last two steps to the Web. XML, so that the request can access the pages in the cache when the request arrives, so as to provide the corresponding page speed.

RestfulAndSoapCache

From http://sourceforge.net/project/showfiles.php? Group_id = 93232 download cache server.

· Use the CD command to switch to the bin directory.

· Type startup. Sh to start the service.

By default, port 8080 is used, and both restful and soap Web servers use this port. Pay attention to port occupation.

· Cache Server can be used at this time. You can use any other language of Java. For more information, see

Http://ehcache.sourceforge.net/documentation/cache_server.html.

Jcache style caching

In the net. Sh. ehcache. jcache package, ehcache has a rough Implementation of jcache in the early stage.

Spring,Cocoon,AcegiAnd other frameworks

Generally, when combined with these frameworks to use ehcache, there is not much special. You only need to pay attention to the following points:

· Note what cache is used in these frameworks.

· Create ehcache. XML, configure the cache, and put it in your classpath path.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.