PhantomJS保持缓存 [英] PhantomJS keeping cache

查看:146
本文介绍了PhantomJS保持缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用phantom js测试访问网页,这在大约半小时的时间内运行了350次.然后,我在服务器上运行webalizer来测试页面访问.

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.

我的phantom js客户端位于phantom js的1个实例中,因此从某种意义上来说,它的工作原理是,一旦一个客户端打开了网页,便启动了下一个客户端,所有客户端始终都具有单独的IP地址和MAC地址.

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.

但是我在webalizer中发现的是,虽然我得到350次服务器命中,但我在每个phantomjs实例上仅获得1次命中,我在某些css文件和其他css文件上运行.因此,我想到了将客户端缓存在一起的想法.

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.

我曾在调用幻影js实例时尝试运行--max-disk-cache-size = 0,但仍然看到它的行为相同.

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?

推荐答案

page.open可以清除缓存之前运行page.clearMemoryCache();.

Run page.clearMemoryCache(); before page.open can clean cache.

它在此问题中提及,并且在PhantomJS 2.0中运行良好.

It metioned in this issue, and it works fine in PhantomJS 2.0.

这篇关于PhantomJS保持缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆