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.

84 lines
1.6 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. * @return bool
  35. */
  36. abstract public function del($key);
  37. /**
  38. * Flush all existing items
  39. *
  40. * @return bool
  41. */
  42. abstract public function flush();
  43. /**
  44. * Retrieve item from the cache
  45. *
  46. * @param mixed $key
  47. * @return mixed
  48. */
  49. abstract public function get($key);
  50. /**
  51. * Increment item's value
  52. *
  53. * @param string $key
  54. * @param int $increment
  55. * @return bool
  56. */
  57. abstract public function increment($key, $increment = 1);
  58. /**
  59. * Replace value of the existing item
  60. *
  61. * @param string $key
  62. * @param mixed $value
  63. * @param int $expire
  64. * @return bool
  65. */
  66. abstract public function replace($key, $value, $expire = 0);
  67. /**
  68. * Store data in the cache
  69. *
  70. * @param string $key
  71. * @param mixed $value
  72. * @param int $expire
  73. * @return bool
  74. */
  75. abstract public function set($key, $value, $expire = 0);
  76. }