You are here

class AcquiaLiftReportCache in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 includes/AcquiaLiftReportCache.inc \AcquiaLiftReportCache

Class AcquiaLiftReportCache

An OOP wrapper around cache_get() and cache_set().

Hierarchy

Expanded class hierarchy of AcquiaLiftReportCache

File

includes/acquia_lift.classes.inc, line 1683
Provides an agent type for Acquia Lift

View source
class AcquiaLiftReportCache implements AcquiaLiftReportCacheInterface {

  /**
   * Holds the reports retrieved from the cache.
   *
   * @var array
   */
  protected $cache = array();

  /**
   * The cache bin to use.
   *
   * @var string
   */
  protected $bin = 'cache_acquia_lift_reports';

  /**
   * Implements AcquiaLiftReportCacheInterface::getCachedReports().
   */
  public function getCachedReports($agent_name) {
    if (!isset($this->cache[$agent_name])) {
      if ($get = cache_get($agent_name, $this->bin)) {
        $this->cache[$agent_name] = $get->data;
      }
      else {
        $this->cache[$agent_name] = FALSE;
      }
    }
    return $this->cache[$agent_name];
  }

  /**
   * Implements AcquiaLiftReportCacheInterface::cacheReports().
   */
  public function cacheReports($agent_name, $data) {
    cache_set($agent_name, $data, $this->bin);
  }

}

Members