apc_cache

Categories

Component ID

2673714

Component name

apc_cache

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Note: PHP 5.5 and above: If you are using PHP 5.5 or above PHP includes a core OPcache system that is superior (marginally better performance, more importantly far fewer bugs). This module does not presently support clearing OPcache or displaying its metadata.

Description
This is a simple module for viewing and clearing the APC cache. This borrows ideas from APC Flush but removes the complexity of the multiple server scenarios suppoted by that module. In contrast to APC Admin this code does not include apc.php (from the APC project) thereby tightening security.

A web admin UI is provided for clearing and viewing (quite rudimentary) information about the APC "filehits" cache. This page allows the user to limit their operations either the "user" or the "system" (filehits) cache, or both caches. The module provides the drupal permission 'administer apc_cache'.

Drush commands are available to view and clear the APC cache:

$ drush @ob7 help apc-cache-info
View basic APC cache information

Aliases: aci, apc-info

$ drush @ob7 help apc-cache-clear
Clear the APC cache.

Aliases: acc, apc-cc

In order to access the APC cache on the web server drush needs to make an http request to a menu router path provided by the module. These paths do not use drupal permissions to restrict access, but they do require a secret token. The token is created when the module is enabled and deleted when the module is disabled. So disabling and re-enabling the module will create a new token.

Requests to the module's paths which use the wrong token will result in "page not found" with the drupal breadcrumb set to its default state so as not to disclose any information about the module's existence on the site.

All attempts to clear the APC cache are logged in watchdog and include the HTTP User-Agent, Remote-Addr and Forwarded headers.

Use case:

Occasionally our sites encounter the infamous "Unable to allocate memory for pool" errors. This situation usually corrects itself over time, but clearing APC fixes it right away. Since these sites are hosted with a service where we can't otherwise clear the APC cache, we created this module.