コード例 #1
0
 /**
  * Create the CachedModel using the modelname, cache and datasource
  * @param string $modelName The name of the model
  * @param Cache  $cache     The cache to use
  */
 public function __construct($modelName, Cache $cache)
 {
     $this->modelName = $modelName;
     $this->cache = $cache;
     $data = $this->cache->get($this->modelName);
     if ($data !== null) {
         $this->prepared = true;
         $this->model = $data;
     }
 }