You are here

class AcquiaLiftReportCache in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 includes/acquia_lift.classes.inc \AcquiaLiftReportCache

Class AcquiaLiftReportCache

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

Hierarchy

Expanded class hierarchy of AcquiaLiftReportCache

1 string reference to 'AcquiaLiftReportCache'
AcquiaLiftReportFactory::create in includes/AcquiaLiftReportFactory.inc
Creates a Report object.

File

includes/AcquiaLiftReportCache.inc, line 8

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