You are here

class crumbs_TrailCache in Crumbs, the Breadcrumbs suite 7.2

Class crumbs_Container_LazyTrails

Hierarchy

Expanded class hierarchy of crumbs_TrailCache

File

lib/TrailCache.php, line 6

View source
class crumbs_TrailCache {

  /**
   * @var array
   *   Cached data
   */
  protected $data = array();

  /**
   * @var crumbs_TrailFinder
   */
  protected $source;

  /**
   * @todo Add an interface for $source.
   *   Don't restrict it to crumbs_TrailFinder.
   *
   * @param crumbs_TrailFinder $source
   */
  function __construct($source) {
    $this->source = $source;
  }

  /**
   * @param $path
   * @return mixed
   */
  function getForPath($path) {
    if (!isset($this->data[$path])) {
      $this->data[$path] = $this->source
        ->getForPath($path);
    }
    return $this->data[$path];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
crumbs_TrailCache::$data protected property Cached data
crumbs_TrailCache::$source protected property
crumbs_TrailCache::getForPath function
crumbs_TrailCache::__construct function @todo Add an interface for $source. Don't restrict it to crumbs_TrailFinder.