I also faced that issue then finally I found a solution.
$ curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar
$ chmod +x cachetool.phar
You can connect to a automatically guessed fastcgi server (if /var/run/php5-fpm.sock
is a file or 127.0.0.1:9000
)
apc
apc:bin:dump Get a binary dump of files and user variables
apc:bin:load Load a binary dump into the APC file and user variables
apc:cache:clear Clears APC cache (user, system or all)
apc:cache:info Shows APC user & system cache information
apc:cache:info:file Shows APC file cache information
apc:key:delete Deletes an APC key
apc:key:exists Checks if an APC key exists
apc:key:fetch Shows the content of an APC key
apc:key:store Store an APC key with given value
apc:sma:info Show APC shared memory allocation information
opcache
opcache:configuration Get configuration information about the cache
opcache:reset Resets the contents of the opcode cache
opcache:status Show summary information about the opcode cache
opcache:status:scripts Show scripts in the opcode cache
Example :
[root@ip-172-31-5-244 ~]# php cachetool.phar opcache:status
+----------------------+---------------------------------+
| Name | Value |
+----------------------+---------------------------------+
| Enabled | Yes |
| Cache full | No |
| Restart pending | No |
| Restart in progress | No |
| Memory used | 42.71 MiB |
| Memory free | 85.29 MiB |
| Memory wasted (%) | 0 b (0%) |
| Strings buffer size | 8 MiB |
| Strings memory used | 5.31 MiB |
| Strings memory free | 2.69 MiB |
| Number of strings | 103847 |
+----------------------+---------------------------------+
| Cached scripts | 1261 |
| Cached keys | 2748 |
| Max cached keys | 7963 |
| Start time | Thu, 08 Feb 2018 02:28:56 +0000 |
| Last restart time | Thu, 08 Feb 2018 03:10:19 +0000 |
| Oom restarts | 0 |
| Hash restarts | 0 |
| Manual restarts | 1 |
| Hits | 47839 |
| Misses | 1269 |
| Blacklist misses (%) | 0 (0%) |
| Opcache hit rate | 97.415899649752 |
+----------------------+---------------------------------+
[root@ip-172-31-5-244 ~]#
[root@ip-172-31-5-244 ~]#
[root@ip-172-31-5-244 ~]# php cachetool.phar opcache:reset
[root@ip-172-31-5-244 ~]#
[root@ip-172-31-5-244 ~]#
[root@ip-172-31-5-244 ~]# php cachetool.phar opcache:status
+----------------------+---------------------------------+
| Name | Value |
+----------------------+---------------------------------+
| Enabled | Yes |
| Cache full | No |
| Restart pending | No |
| Restart in progress | No |
| Memory used | 10.43 MiB |
| Memory free | 117.57 MiB |
| Memory wasted (%) | 0 b (0%) |
| Strings buffer size | 8 MiB |
| Strings memory used | 545.69 KiB |
| Strings memory free | 7.47 MiB |
| Number of strings | 103847 |
+----------------------+---------------------------------+
| Cached scripts | 0 |
| Cached keys | 0 |
| Max cached keys | 7963 |
| Start time | Thu, 08 Feb 2018 02:28:56 +0000 |
| Last restart time | Thu, 08 Feb 2018 03:19:00 +0000 |
| Oom restarts | 0 |
| Hash restarts | 0 |
| Manual restarts | 2 |
| Hits | 0 |
| Misses | 2 |
| Blacklist misses (%) | 0 (0%) |
| Opcache hit rate | 0 |
+----------------------+---------------------------------+
You can notice that the memory, cache keys, hits everything became 0. It's very useful. I also intrigrated it with Ansible easily.
It’s and application for APCU and others stuffs: Check more info here.