3

To cache JS, CSS, images files on disk, so that PhantomJS load from local disk and not make an external ResourceRequested untill cache period expires.

I am interested in saving external hits. I have tried --disk-cache=true but cannot see css or js or images on cache paths :

Linux : ~/.qws/cache/Ofi Labs/PhantomJS

Windows : AppData\Local\Ofi Labs\PhantomJS\cache

Any info on this is thankful.

UPDATE : Version 1.9.7

All i could see on *.d files in cache folders, all resources are still requested

Yogesh Unavane
  • 265
  • 3
  • 11
  • 1.9.7, it is. All i could see on *.d files in cache folders, all resources are still requested. – Yogesh Unavane Sep 23 '14 at 16:48
  • possible duplicate of [Grab the resource contents in CasperJS or PhantomJS](http://stackoverflow.com/questions/11531448/grab-the-resource-contents-in-casperjs-or-phantomjs) with this [answer](http://stackoverflow.com/a/14717026). – Artjom B. Sep 23 '14 at 17:03
  • I just tried the disk-cache option on cnn.com. The page load with an empty cache was around 12 seconds (175 resources requested) and with a warm cache around 6 seconds (171 resources requested) with multiple trials. So it works. Are you sure that your page sets the cache-control header? – Artjom B. Sep 23 '14 at 17:07
  • in your warm cache, did files were in cache folder's ? When i log page.onResourceRequested, urls hits are same in both, empty and warm. – Yogesh Unavane Sep 23 '14 at 17:11
  • It looks like `onResourceReceived` and `onResourceRequested` are called regardless of whether the resource is cached or not. Your actual question should be answered with the above link though ([here](http://stackoverflow.com/a/14717026) again). – Artjom B. Sep 23 '14 at 17:36

0 Answers0