users@glassfish.java.net

Re: RE: Question about caching

From: <glassfish_at_javadesktop.org>
Date: Mon, 25 May 2009 04:57:19 PDT

Hello Martin,

Thanks your answer, but these settings were already set in my sun-web.xml Here is my sun-web.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app>
  <context-root>add</context-root>
  <cache max-entries="4096" timeout-in-seconds="6000" enabled="true">
    <cache-mapping>
        <timeout>6000</timeout>
        <url-pattern>/services/MediaService/getTracksByGenreIds/*</url-pattern>
        <key-field name='startPage' scope='request.parameter'>
        </key-field>
        <key-field name='genresIds' scope='request.parameter'>
        </key-field>
        <key-field name='maxResults' scope='request.parameter'>
        </key-field>
        <key-field name='orderByColumn' scope='request.parameter'>
        </key-field>
        <key-field name='orderByDir' scope='request.parameter'>
        </key-field>
    </cache-mapping>
    <cache-mapping>
        <timeout>6000</timeout>
        <url-pattern>/services/MediaService/getVideosByGenreIds/*</url-pattern>
        <key-field name='startPage' scope='request.parameter'>
        </key-field>
        <key-field name='genresIds' scope='request.parameter'>
        </key-field>
        <key-field name='maxResults' scope='request.parameter'>
        </key-field>
        <key-field name='orderByColumn' scope='request.parameter'>
        </key-field>
        <key-field name='orderByDir' scope='request.parameter'>
        </key-field>
        <key-field name='recursive' scope='request.parameter'>
        </key-field>
    </cache-mapping>
  </cache>

</sun-web-app>


You can call the webservice at: http://67.192.86.35/add/services/MediaService/getVideosByGenreIds?genresIds=239&maxResults=10&recursive=true

and the other one (which is also cached): http://67.192.86.35/add/services/MediaService/getTracksByGenreIds?genresIds=22032&maxResults=10&recursive=true

You can see if you call these two services again the second one's response time is much faster than the first one. The caching works well in case of getTracksByGenresIds and I dont know why?
[Message sent by forum member 'nadasipeter' (nadasipeter)]

http://forums.java.net/jive/thread.jspa?messageID=347538