Cache.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. *
  4. * Cube Framework $Id$ Geg1DnRtwCPJ6exu0snYrA6mThBak7I6KyZli1TYyZY=
  5. *
  6. * @link http://codecu.be/framework
  7. * @copyright Copyright (c) 2017 CodeCube SRL
  8. * @license http://codecu.be/framework/license Commercial License
  9. *
  10. * @version 1.9 [rev.1.9.01]
  11. */
  12. /**
  13. * creates a cache resource
  14. */
  15. namespace Cube\Application\Resource;
  16. use Cube\Cache as CacheObject;
  17. class Cache extends AbstractResource
  18. {
  19. /**
  20. *
  21. * cache object
  22. *
  23. * @var \Cube\Cache
  24. */
  25. protected $_cache;
  26. /**
  27. *
  28. * initialize translate object
  29. *
  30. * @throws \InvalidArgumentException
  31. * @return \Cube\Cache
  32. */
  33. public function init()
  34. {
  35. if (!($this->_cache instanceof CacheObject)) {
  36. if (!isset($this->_options['cache']['adapter'])) {
  37. $this->_options['cache']['adapter'] = '\\Cube\\Cache\\Adapter\\Files';
  38. }
  39. $this->_cache = CacheObject::getInstance($this->_options['cache']);
  40. }
  41. return $this->_cache;
  42. }
  43. }