1. 11 Apr, 2019 1 commit
  2. 28 Sep, 2018 1 commit
    • totten's avatar
      Register "short" and "long" cache services · 90cdaa0e
      totten authored
      Overview
      --------
      
      This is an improvement for developer-experience when working with caches.
      It reduces the amount of boilerplate required for core-code or
      extension-code in a typical caching use-case.
      
      Before
      ------
      
      * To use a short-lived/latency-optimized cache (e.g. Redis or PHP array),
        you can work with the default cache instance (`Civi::cache('default')`.
      * To use a long-lived/durability-optimized cache (e.g. Redis or SQL), there is no
        simple way or code. You must [register a custom cache service](https://docs.civicrm.org/dev/en/latest/framework/cache/#example-named-service).
      
      After
      -----
      
      * All the above remains true. Additionally, you can request the `short` or `long` cache service.
      * To use a short-lived/latency-optimized cache, you can use `Civi::cache('short')`. (`short` and `default` are synonmyms.)
      * To use a long-lived/durability-optimized cache, you can use use `Civi::cache('long')`.
      
      Comments
      --------
      
      * After this is approved, we should update the [dev docs for caching](https://docs.civicrm.org/dev/en/latest/framework/cache/).
      * There's a bike-sheddy argument about the naming. I'd be willing to rename if there was a strong reason, but I don't really think
        there is a strong reason. This naming convention provides a simple dichotomy of `short` vs `long`.
      90cdaa0e
  3. 27 Sep, 2018 1 commit
    • totten's avatar
      (DX) Civi::contactSettings - Add a facade for working with the logged-in user's settings · 01d70c56
      totten authored
      Before
      ------
      
      To read/write a setting for the logged-in user, you need a snippet like this:
      
      ```php
      $cid = CRM_Core_Session::getLoggedInContactID();
      $myFilter = Civi::service('settings_manager')
        ->getBagByContact(NULL, $cid)
        ->get('activity_tab_filter');
      ```
      
      After
      -----
      
      To read/write a setting for the logged-in user, you can use a snippet like this:
      
      ```php
      $myFilter = Civi::contactSettings()->get('activity_tab_filter');
      ```
      
      Technical Details
      -----------------
      
      * A convenience function like this is liable to be used in lazy circumstances where
        the developer is unlikely to check their conditions carefully. Therefore, the
        errors are reported as exceptions so that mistakes are easiliy revealed.
      * This is technically a small contract change to `SettingsManager::getBagByContact()`
        because it now interprets `$contactId===NULL` as meaning "the logged-in user".
        However, I don't think NULL was a sensible value before, and this interface
        isn't widely known/used.
      01d70c56
  4. 27 Jun, 2018 1 commit
  5. 30 Mar, 2017 1 commit
  6. 23 Nov, 2015 1 commit
  7. 22 Nov, 2015 1 commit
  8. 21 Sep, 2015 3 commits
  9. 17 Sep, 2015 5 commits