I am using phantom js to test accessing a webpage, this runs approximatley 350 times in the space of about half an hour. I am then running webalizer against the server to te
Run page.clearMemoryCache();
before page.open
can clean cache.
It metioned in this issue, and it works fine in PhantomJS 2.0.
There is no way to clear cache (memory or disk). An issue is open on github here since a few months and I still hope this will be released in the future.
This only way is to start a new instance of phantomjs with no disk cache.
PhantomJs is a headless browser, so please consider a PhantomJS instance as an unique user. Does opening 100 times the same web page in your favorite browser will downlaod 100 times every resources of your web page ? No, this is exactly how PhantomJS works.