Skip to content
  • totten's avatar
    Allow rerouting CRM_Core_BAO_Cache::{set,get}Item(s) to PSR-16 drivers · 5a302bbc
    totten authored
    Before
    ----------------------------------------
    
    * Requests for `CRM_Core_BAO_Cache` (`setItem($data,$group,$path)`,
      `getItem($group,$path)`, `getItems($group)`, `deleteGroup($group,$path)`)
      are *always* served by two tiers: (1) an in-memory array (`static::$cache`) and (2)
      an SQL table.
    
    After
    ----------------------------------------
    
    * There is a config option `define('CIVICRM_BAO_CACHE_ADAPTER',
      'CRM_Core_BAO_Cache_Psr16');`.
        * When disabled (default), `CRM_Core_BAO_Cache` continues using the old code.
        * When enabled, `CRM_Core_BAO_Cache` changes behavior. Each `$group` is mapped to
          a PSR-16 object.
    
    * The class/implementation for each `$group` depends on the configuration:
        * In a typical (non-Redis/non-Memcache) deployment, the implementation
          is `CRM_Utils_Cache_SqlGroup`, which has the same 2-tier structure
          (in-memory+SQL).
        * In Redis/Memcache deployment, the implementation combines
          `FastArrayDecorator` with `CRM_Utils_Cache_Redis` or
          `CRM_Utils_Cache_Memcache`.  This gives a similar 2-tier structure
          (e.g. in-memory+Redis).
    5a302bbc