Forums de discussion

Service Builder JsonWS caching issue

Jeffrey Jarin, modifié il y a 10 années.

Service Builder JsonWS caching issue

Junior Member Publications: 30 Date d'inscription: 05/07/13 Publications récentes
Good Day,

I would just like to ask how the service builder / liferay cache the objects? is there as way I could disable it?
The problem is that I'd tried to put a pre defined date filter like today(09-12-2013), yestersday(09-11-2013) and last 7 days and when i tried to deploy it on our DEV environment
the filter works fine but after a day the Dates are not updated like it should be for tomorrow will be today(09-13-2013), etc... , The date filter are cache afaik when it was deployed and all the dates since it was deployed will be cached and will not update its date only until i restarted the server, but restarting the server on daliy basis should not be an option

im doing the Date Filter using Jodatime inside my utility.java in Service Builder

is this Service Builder Specific or its a liferay portal specific?

Thanks
Jeff
thumbnail
M J, modifié il y a 10 années.

RE: Service Builder JsonWS caching issue

Regular Member Publications: 184 Date d'inscription: 01/03/13 Publications récentes
Add cache-enabled="false" to entity. Here is a sample from service.xml:


  <entity name="Table1" local-service="true" remote-service="false" cache-enabled="false">
    <column name="table1Id" type="long" primary="true" id-type="identity" />
    <column name="companyId" type="long" />
    <column name="groupId" type="long" />

    <order by="desc">
      <order-column name="table1Id" />
    </order>

    <!-- Finder Methods Standard -->
    <finder name="GroupId" return-type="Collection">
      <finder-column name="groupId" />
    </finder>
    <finder name="CompanyId" return-type="Collection">
      <finder-column name="companyId" />
    </finder>
  </entity>


MJ
Jeffrey Jarin, modifié il y a 10 années.

RE: Service Builder JsonWS caching issue

Junior Member Publications: 30 Date d'inscription: 05/07/13 Publications récentes
Hi MJ, thanks for the reply but I already have that on my Service.xml and also i just added the java class to return an array of string in Dates
Utility.java >
public List<String> getOffersFilter() {
List<String> filterList = new ArrayList<String>();
filterList.add(getToday());
filterList.add(getYesterday());
filterList.add(getLast7Days());
filterList.add(getLast30Days());
filterList.add(getThisMonth());
filterList.add(getLastMonth());
filterList.add(getLast3Months());
filterList.add(getLastYear());
return filterList;
}

its not actually an entity related thing - not sure if its with jodatime or with the service builder emoticon
thumbnail
Kan Zhang, modifié il y a 10 années.

RE: Service Builder JsonWS caching issue

Junior Member Publications: 68 Date d'inscription: 01/12/10 Publications récentes
Hi Jeff,

In what layer/class did you put the date filter?

Have you tried to put a break point in your getOffersFilter() method to see if it is actually getting called in the subsequent JsonWS calls?

Also I suggest to use Firebug to check the response headers of each JsonWS calls to see if they are being cached in the web browser.
Jeffrey Jarin, modifié il y a 10 années.

RE: Service Builder JsonWS caching issue

Junior Member Publications: 30 Date d'inscription: 05/07/13 Publications récentes
Thanks Kan, here is the headers for the first call

Response Headers
Connection keep-alive
Content-Length 958
Content-Type text/html;charset=utf-8
Date Tue, 17 Sep 2013 16:41:30 GMT
Server nginx
WWW-Authenticate Basic realm="PortalRealm"
Request Headers
Accept application/json, text/javascript, */*
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Cookie __utma=27178300.840633310.1376421876.1376421876.1376421876.1; __utmz=27178300.1376421876.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); GUEST_LANGUAGE_ID=en_US; COOKIE_SUPPORT=true; JSESSIONID=nSBshHji050Ewxwe--cI1G4M.undefined; USER_UUID=Ut/QyFn+3Cfi27mS3tMW60E+mj/sse3n; LFR_SESSION_STATE_11324=1379367559792; LFR_SESSION_STATE_10538=1379436030112; COMPANY_ID=10154; ID=386b6a4c715a5745375a773d



second call is


Response Headers
Cache-Control private, no-cache, no-store, must-revalidate
Connection keep-alive
Content-Length 227
Content-Type text/javascript;charset=UTF-8
Date Tue, 17 Sep 2013 16:42:08 GMT
Server nginx
Request Headers
Accept application/json, text/javascript, */*
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Cookie __utma=27178300.840633310.1376421876.1376421876.1376421876.1; __utmz=27178300.1376421876.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); GUEST_LANGUAGE_ID=en_US; COOKIE_SUPPORT=true; JSESSIONID=nSBshHji050Ewxwe--cI1G4M.undefined; USER_UUID=Ut/QyFn+3Cfi27mS3tMW60E+mj/sse3n; LFR_SESSION_STATE_11324=1379367559792; LFR_SESSION_STATE_10538=1379436030112; COMPANY_ID=10154; ID=386b6a4c715a5745375a773d


third call is the same header as the second one

my thoughts is that it's probably with the Service Builder or with the JodaTime itself

in my service.xml i already placed cache-enabled="false" to each entity

My DataFilter is being called inside the com.foo.util package that i added under src folder

My problem still persist - the Date filters i have on my dropdown is not getting the correct dates today but the dates it was deployed
Lesha Lesha, modifié il y a 9 années.

RE: Service Builder JsonWS caching issue

New Member Publications: 7 Date d'inscription: 06/10/14 Publications récentes
And after a while, the cache is reset ???
And where this can be changed ?
Lesha Lesha, modifié il y a 9 années.

RE: Service Builder JsonWS caching issue

New Member Publications: 7 Date d'inscription: 06/10/14 Publications récentes
Lesha Lesha:
And after a while, the cache is reset ???
And where this can be changed ?



Can you help me??