I need to change the default time of automatic cache clear for Phantomjs if there is such a feature. Any idea?
Should be the feature that you are looking for:
https://github.com/ariya/phantomjs/issues/10357
page.clearMemoryCache()
Each PhantomJS process has its own in-memory cache, so there is no need to clear it between script executions. You can let PhantomJS save the cache in disk, so that it persists accross executions. See the --disk-cache
option.
There is no way to clear the cache during a script execution.
localStorage
on the other hand is persisted every time and you cannot turn it off. So you may need to add the following snippet before exiting PhantomJS.
page.evaluate(function(){
localStorage.clear();
});
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