(MAVEN+SSH) online Store project actual combat page Cache Oscache

Source: Internet
Author: User

What is Oscache?
is a high-performance Java EE caching framework that caches part of a JSP or HTTP request and can be cached by any JavaScript object
The cache is stored in the form of key value.
can also be permanently cached: Cache can be written to disk at will
Support Cluster

Using Oscache:
1. Make the required Jar copy Lib
2. Put the Oscache installation directory oscache.properties into the SRC directory
3. Introduction of <% @taglib prefix= "Oscache" uri= "Http://www.opensymphony.com/oscache"%>
4. Page Add cache
<oscache:cache>
Cache time: <%=new date ()%><br/>
</oscache:cache>


Key:http://localhost:8888/oscache_test/?id=1
value:index.jsp

The cache key will consist of the requested url+ query string
The cache is stored by default in the application range, and the cache time defaults to 3,600 seconds and 1 hours
Cons: Data update is not timely


<oscache:cache key= "Name" >
No longer consists of a url+ query string

Global Cache configuration:

  <filter>          <filter-name> Cachefilter</filter-name>          <filter-class >com.opensymphony.oscache.web.filter.CacheFilter</filter-class>          <init-param>              <param-name>time</param-name>              <param-value>5</param-value>          </init-param>         <init-param>              <param-name>scope</param-name>              <param-value>application </param-value>         </init-param>   </filter>  < Filter-mapping>  <filter-name>cachefilter</filter-name>  <url-pattern >*.jsp</url-pattern>  </filter-mapping>


Oscache Configuration Properties Introduction

Specify the capacity of the cache: cache.capacity=1000
Whether to use memory cache, default is True:cache.memory=false
If specified due to hard disk cache:

cache.memory=falsecache.capacity=1000cache.path=d:\\cachecache.persistence.class= Com.opensymphony.oscache.plugins.diskpersistence.DiskPersistenceListener


This article is from the "Lao Niu Java" blog, please be sure to keep this source http://liuyj.blog.51cto.com/2340749/1714599

(MAVEN+SSH) online Store project actual combat page Cache Oscache

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.