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.

85 lines
1.7 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-04
  8. * @version SVN: $Id$
  9. * @filesource $URL$
  10. */
  11. abstract class Cache
  12. {
  13. /**
  14. * Add an item to the cache
  15. *
  16. * @param string $key
  17. * @param mixed $value
  18. * @param int $expire
  19. * @return bool
  20. */
  21. abstract public function add($key, $value, $expire = 0);
  22. /**
  23. * Decrement item's value
  24. *
  25. * @param string $key
  26. * @param int $decrement
  27. * @return bool
  28. */
  29. abstract public function decrement($key, $decrement = 1);
  30. /**
  31. * Delete item from the cache
  32. *
  33. * @param string $key
  34. * @param int $value
  35. * @return bool
  36. */
  37. abstract public function del($key);
  38. /**
  39. * Flush all existing items
  40. *
  41. * @return bool
  42. */
  43. abstract public function flush();
  44. /**
  45. * Retrieve item from the cache
  46. *
  47. * @param mixed $key
  48. * @return mixed
  49. */
  50. abstract public function get($key);
  51. /**
  52. * Increment item's value
  53. *
  54. * @param string $key
  55. * @param int $increment
  56. * @return bool
  57. */
  58. abstract public function increment($key, $increment = 1);
  59. /**
  60. * Replace value of the existing item
  61. *
  62. * @param string $key
  63. * @param mixed $var
  64. * @param int $expire
  65. * @return bool
  66. */
  67. abstract public function replace($key, $value, $expire = 0);
  68. /**
  69. * Store data in the cache
  70. *
  71. * @param string $key
  72. * @param mixed $value
  73. * @param int $expire
  74. * @return bool
  75. */
  76. abstract public function set($key, $value, $expire = 0);
  77. }