<?php

class MaterialRepositoryCache extends MaterialRepository
{
  const CACHE_KEY = "materialRepository";
  public function parse()
  {
    if(Cache::has(self::CACHE_KEY))
    {
      $this->database = Cache::get(self::CACHE_KEY);
      return;
    }
    $this->database = parent::read();
    Cache::put(self::CACHE_KEY, $this->database, 60);
  }

}


<?php

class MaterialRepositoryCache extends MaterialRepository
{
  const CACHE_KEY = "materialRepository";
  public function parse()
  {
    if(Cache::has(self::CACHE_KEY))
    {
      $this->database = Cache::get(self::CACHE_KEY);
      return;
    }
    $this->database = parent::read();
    $this->snapshot();
  }

  public function snapshot()
  {
    Cache::put(self::CACHE_KEY, $this->database, 60);
  }

}


Make the material repository cache behave like the other caches.
Make the material repository cache behave like the other caches.
