You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

  1. <?php
  2. /**
  3. * @copyright NetMonsters <team@netmonsters.ru>
  4. * @link http://netmonsters.ru
  5. * @package Majestic
  6. * @subpackage Cache
  7. * @since 2010-03-10
  8. * @version SVN: $Id$
  9. * @filesource $URL$
  10. */
  11. class CacheKeySet extends CacheKey
  12. {
  13. public function get()
  14. {
  15. $set = $this->cache->get($this->key);
  16. $item_key = $this->getCacheKey();
  17. if (!is_array($set) || !array_key_exists($item_key, $set)) {
  18. return false;
  19. }
  20. return $this->cache->get($item_key);
  21. }
  22. /**
  23. * @param mixed $value
  24. */
  25. public function set($value)
  26. {
  27. $set = $this->cache->get($this->key);
  28. if (!is_array($set)) {
  29. $set = array();
  30. }
  31. $item_key = $this->getCacheKey();
  32. if (!$this->cache->set($item_key, $value, $this->expire)) {
  33. return false;
  34. }
  35. $set[$item_key] = $this->cache->getExpire($this->expire);
  36. return $this->cache->set($this->key, $set, $this->expire);
  37. }
  38. public function del()
  39. {
  40. return $this->cache->del($this->key);
  41. }
  42. }