Details
-
Type: Task
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.4.8
-
Fix Version/s: 4.3.0
-
Component/s: Core CiviCRM, NYSS
-
Labels:None
-
Funding Source:Core Team Contract
Description
Please see NYSS issue #5461 (http://dev.nysenate.gov/issues/show/5461)
Description below:
There are now three different database caching modules in CiviCRM: ArrayCache, Memcache, and Memcached.
ArrayCache is a NYSS-contributed module that provides basic per-request caching in the absence of a cross-request caching mechanism (ie. memcached).
Memcache is the original CiviCRM persistent caching module. It uses PHP's "Memcache" extension to accomplish its work.
Memcached is almost identical to Memcache, except for some key-munging that must be done prior to writing or reading from the cache. It uses PHP's "Memcached" extension, which is a more modern and robust interface to the memcached daemon, making use of libmemcached.
CiviCRM currently uses the CIVICRM_USE_MEMCACHE and CIVICRM_USE_ARRAYCACHE defines to control which cache module is used.
Since only one cache can be used at one time, it makes sense to deprecate these defines in favor of a new CIVICRM_DB_CACHE_CLASS define, which controls which caching module will be used.
This requires changes to civicrm.settings.php (where the defines reside), Cache.php (the factory class for the various caching mechanisms), and the Bluebird config file (removing cache.memcache and cache.arraycache, and replacing with cache.db.class).
In addition, I have also modified Memcache.php and Memcached.php to utilize a simpler, one-parameter constructor. This allows for easier expansion in the future, if other caching modules are implemented.
Please see the following two Bluebird commits for patches:
https://github.com/nysenate/Bluebird-CRM/commit/7852f7396680ef3f90ee578c55a3dbee1e8af460
https://github.com/nysenate/Bluebird-CRM/commit/4a1f07b53ede889a6d24015265473c80ceb70f42