PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: Cache issue
   PostPosted: 20 Dec 2011, 08:26 
Hi,

I am currently evaluating the product and I ran into a chaching issue.
I use PD4ML with Coldfusion.

With CFML I generate the HTML and then feed that to a PD4ML object in
CFSCRIPT:

<cfscript>
pd4ml = createObject("java","org.zefer.pd4ml.PD4ML");
</cfscript>

No while experimenting with a pdf generation tool, I noticed that my CSS links are not refreshed. The content of the seperate CSS file is being cached.
Only when I add:
pd4ml.clearCache();
does it refresh.

Is this correct or is this inefficient?

Thanks,

Mattijs


  Subject: Re: Cache issue
   PostPosted: 08 Feb 2012, 20:21 
Does it mean, the CSS link in your scenario remains the same, but the document, it returns, changes from time to time?


  Subject: Re: Cache issue
   PostPosted: 10 Feb 2012, 01:39 
The link to the css stays the same, but the content of the style sheet was altered.
It def looked as if the CSS content of the file was being casched in memory.

cheers,

mattijs


  Subject: Re: Cache issue
   PostPosted: 16 Feb 2012, 20:08 
PD4ML does not test if a particular resource (image or stylesheet) has been changed: if it has a cached version - it uses it.

You may explicitly disable caching with pd4ml.cache.enable=false environment variable, or with a dynamic parameter.

Map m = new HashMap();
m.put(PD4Constants.PD4ML_CACHE_ENABLE, false);
pd4ml.setDynamicParams(m);


We've just refined clearCache() method in the development build, but as I got it worked for you before.

Another workaround would be to add a harmless dynamically generated parameter to the stylesheet reference:

./styles/main.css?rnd=<random_number>

It should distinguish a new stylesheet from ones loaded before. As a drawback of the approach it will accumulate stylesheet versions in the cache. It is not that dramatic, as they are cached as soft references, but anyway it is a good idea to perform clearCache() from time to time.



[Reply]     [ 4 posts ] 

Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share