PHP Caching

Overview

General info on supported external caching for Sugar.

Supported External Caching Mechanisms

Sugar supports the following external caches:
  • APC (Linux)
  • Memcache (Linux)
  • Memcached (Linux)
  • Redis (Linux)
  • sMash (Linux)
  • Wincache (Windows)
  • Zend (Linux)

Disabling External Caches

In server configurations where you have multiple external caches enabled for other applications and services, you may want to ensure only specific external caching is configured for your Sugar instance. To disable one or more external caches, you can edit the ./config_override.php file and enter any combination of the following lines of code:
$sugar_config['external_cache_disabled'] = true; // Disables all external caching

$sugar_config['external_cache_disabled_apc'] = true; // Disables APC

$sugar_config['external_cache_disabled_memcache'] = true; // Disables Memcache

$sugar_config['external_cache_disabled_memcached'] = true; // Disables Memcached

$sugar_config['external_cache_disabled_redis'] = true; // Disables Redis

$sugar_config['external_cache_disabled_smash'] = true; // Disables sMash

$sugar_config['external_cache_disabled_wincache'] = true; // Disables Wincache

$sugar_config['external_cache_disabled_zend'] = true; // Disables Zend

APC

For Linux servers running Sugar, APC is the recomended opcode cache for PHP with the following guidelines and settings:
  • Use the latest stable version
  • apc.shm size should be close to your program size. For Sugar, that’s at least 150 MB (default for apc.shm is 32 MB). When in doubt, more is always better.
  • If your installation of Sugar is located on a network filesystem such as NFS or CIFS, make sure apc.stat is enabled.
  • apc.ttl should be set to 0. This parameter disables garbage collection and can cause fragmentation. Earlier APC releases had locking issues that made caches with many entries take forever to be garbage collected.
  • apc.shm_segments should be set to the default of 1. If you think you really need multiple shm_segments, you must also read the documentation on apc.mmap_file_mask as well and understand and set that value accordingly. If you don’t understand apc.mmap_file_mask, you should leave apc.shm_segments at the default value.
  • APC ships with an additional "apc.php" file that when hit with a browser, will show settings, cache information, and fragmentation. If you suspect APC problems, this is a great tool to start checking things out.