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.

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