Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web page caching using Ehcache

I am trying to make my web application faster by using caching of web pages for faster access next time so can anyone provide me guideline how to use Ehcache for the same?

like image 517
Hemant Metalia Avatar asked Mar 31 '26 07:03

Hemant Metalia


1 Answers

The Ehcache documentation on web caching should be a good start. For a quick start they also have a code sample / recipe on that.

EDIT: (how to see if it's working)

  1. enable logging for package net.sf.ehcache.constructs.web.filter (e.g. DEBUG level) and look at the log entries
  2. SimplePageCachingFilter is gzipping the response; look for Content-Encoding: gzip in HTTP response headers - Content-Length should be smaller than before
  3. ehcache.xml: configure cache to overflowToDisk="true" and set <diskStore path="target/ehcache-diskStore"/> - a (at first empty) file named SimplePageCachingFilter.data should have been created there
  4. JMX / cache statistics (more complicated; see JMX-Tutorial)
  5. ...
like image 108
jeha Avatar answered Apr 02 '26 20:04

jeha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!