I'm using PhantomJS 1.8 and ran into a limitation -- you can't specify what directory it uses for the disk cache. I added this to their issue tracking system, but since it wasn't in there before, I wouldn't expect it to be added soon.
So, I'm looking for some way around this limitation. What I'm trying to do is have multiple Phantomjs processes running, each with their own, separate, cache directory. Is there a way I can do this until the feature gets added to phantom?
How does phantom even determine which directory to use for cache in the first place? If it's based on an environment variable, maybe there could be some way I set a different value for that variable for each instance of PhantomJS that I have running.
Under PhantomJS 1.9 at least, the cache directory is $HOME/.qws/cache/Ofi Labs/PhantomJS, so if you modify the HOME environment variable before running PhantomJS, you could have a different disk cache for each process. I tested this and it works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With