Model.php 745 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace ForkBB\Models\DBMap;
  3. use ForkBB\Models\Model as ParentModel;
  4. class Model extends ParentModel
  5. {
  6. /**
  7. * Загружает карту БД из кеша/БД
  8. *
  9. * @return DBMap\Model
  10. */
  11. public function init()
  12. {
  13. if ($this->c->Cache->has('db_map')) {
  14. $this->a = $this->c->Cache->get('db_map');
  15. } else {
  16. $map = $this->c->DB->getMap();
  17. $this->c->Cache->set('db_map', $map);
  18. $this->a = $map;
  19. }
  20. return $this;
  21. }
  22. /**
  23. * Сбрасывает кеш карты БД
  24. *
  25. * @return DBMap\Model
  26. */
  27. public function reset()
  28. {
  29. $this->c->Cache->delete('db_map');
  30. return $this;
  31. }
  32. }