In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about the usefulness of OSCache. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
OSCache is an open resource buffer library that can be downloaded for free from http://www.opensymphony.com/oscache/.
OSCache is an open resource buffer library that can be downloaded for free from http://www.opensymphony.com/oscache/.
It includes a set of JSP tags, through which you can easily implement page caching in your program, and you can also use its filter to cache not only JSP pages, but also any Servlet-generated content. There is also a more flexible and easy to use API.
Here are some of its terms (keywords in JSP Tag in parentheses):
Buffer record: an object stored in a buffer is called a buffer record. In a simple WEB program, it is usually a JSP page, part of a JSP page, or the output of Servlet. In complex WEB programs, there are usually some entities Bean.
Buffer key (Key): the resulting structure is like a HashTable. When storing buffered records in the page cache, you must provide a buffer key code to identify each entry. Several request parameters can be combined to form a buffer key; the default is to use the page request URI as the buffer key.
Buffer period (time): the amount of time a buffer record remains in the buffer. For a JSP page that displays data that is updated frequently, you should set a short buffer period.
Buffer domain (Scope): the scope in which buffered records are stored. There are two types: buffered records are stored in the application domain (application) so that the buffered records can be shared by all users, or in the session domain (session), buffered records are stored based on the current user.
= install
Put the three files oscache.jar,oscache.properties and oscache.tld into WEB-INF
Directory structure:
$WEB_APP/WEB-INF/lib/oscache.jar
$WEB_APP/WEB-INF/classes/oscache.properties
$WEB_APP/WEB-INF/classes/oscache.tld
= apply
The following two are optional:
-the first kind:
Add tag library configuration to web.xml:
Oscache
/ WEB-INF/classes/oscache.tld
Add a tag library in JSP
-the second kind:
Add tag libraries directly to JSP
-- OK preparation work is done, together with the various tags provided can be used. Let's introduce the meaning and usage of various labels:
There are two common situations:
Internal content needs to be added
It ends with a single item. There is no need to add content
= cache tag attribute main tag
Key= "xxx": when storing buffered records, the buffer key code is provided to identify each entry. By default, the page request URI is used as the buffer key.
Time= "N seconds": is the time a buffer records in the page buffer. The default is 3600 seconds or an hour. Set "- 1" to permanent.
Refresh= "true | false": whether to refresh. Default is false
Eg.
-
Keep the cached content identified by myKey for 30 minutes and refresh automatically when it expires. If needRefresh is true, it will also be refreshed (suitable for instant refresh of updated content).
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.