Purging OpCache

Table of Contents

  1. Purging
  2. Example Response

The use of OpCache on MageStack is sparing and not aggressive. Which means that it will maintain its own cache contents, updating the entries as necessary, instantly.

It is extremely rare that you'll ever need to clear OpCache except in two circumstances,

  1. If you use a symlink for the root directory of your document root and the symlink changes destination
  2. If you have active overflows and you deploy a code change

In these circumstances, it is possible that OpCache won't detect the file changes and as such, it may be required to clear OpCache.


Purging OpCache is very straightforward and can be tied into deployment scripts,

/usr/bin/php /microcloud/scripts/classes/Opcache.php --lb lb1 --host www.example.com

Replace lb1 and www.example.com with your load balancer node and domain as necessary.

The response is in JSON format confirming all nodes have been successfully purged, in a multi-server stack, or where overflows are provisioned, you'll also see the additional web servers automatically listed.

Example Response

"status": "success",
"message": "Opcache successfully cleared",
"hostname": "web1.c1.sonassihosting.com"