最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - PhantomJS keeping cache - Stack Overflow

programmeradmin2浏览0评论

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 test page accesses.

My phantom js clients are inside 1 instance of phantom js so it basically works in the sense that once one client has opened the web page kick off the next client, all with individual IP addresses and MAC addresses throughout.

However what I am finding in webalizer is that while I get 350 hits to the server I am only getting 1 hit per instance of phantomjs I run on some css files and others. So I have come up with the idea of it caching clients together.

I have attempted running --max-disk-cache-size=0 when calling the phantom js instance but still see it acting the same.

Has anyone experienced the same before?

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 test page accesses.

My phantom js clients are inside 1 instance of phantom js so it basically works in the sense that once one client has opened the web page kick off the next client, all with individual IP addresses and MAC addresses throughout.

However what I am finding in webalizer is that while I get 350 hits to the server I am only getting 1 hit per instance of phantomjs I run on some css files and others. So I have come up with the idea of it caching clients together.

I have attempted running --max-disk-cache-size=0 when calling the phantom js instance but still see it acting the same.

Has anyone experienced the same before?

Share Improve this question asked Apr 30, 2014 at 14:34 CharabonCharabon 7873 gold badges11 silver badges24 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 18

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.

发布评论

评论列表(0)

  1. 暂无评论