ClientContextInterface.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis;
  11. use Predis\Command\CommandInterface;
  12. /**
  13. * Interface defining a client-side context such as a pipeline or transaction.
  14. *
  15. * @method $this del(array $keys)
  16. * @method $this dump($key)
  17. * @method $this exists($key)
  18. * @method $this expire($key, $seconds)
  19. * @method $this expireat($key, $timestamp)
  20. * @method $this keys($pattern)
  21. * @method $this move($key, $db)
  22. * @method $this object($subcommand, $key)
  23. * @method $this persist($key)
  24. * @method $this pexpire($key, $milliseconds)
  25. * @method $this pexpireat($key, $timestamp)
  26. * @method $this pttl($key)
  27. * @method $this randomkey()
  28. * @method $this rename($key, $target)
  29. * @method $this renamenx($key, $target)
  30. * @method $this scan($cursor, array $options = null)
  31. * @method $this sort($key, array $options = null)
  32. * @method $this ttl($key)
  33. * @method $this type($key)
  34. * @method $this append($key, $value)
  35. * @method $this bitcount($key, $start = null, $end = null)
  36. * @method $this bitop($operation, $destkey, $key)
  37. * @method $this bitfield($key, ...)
  38. * @method $this decr($key)
  39. * @method $this decrby($key, $decrement)
  40. * @method $this get($key)
  41. * @method $this getbit($key, $offset)
  42. * @method $this getrange($key, $start, $end)
  43. * @method $this getset($key, $value)
  44. * @method $this incr($key)
  45. * @method $this incrby($key, $increment)
  46. * @method $this incrbyfloat($key, $increment)
  47. * @method $this mget(array $keys)
  48. * @method $this mset(array $dictionary)
  49. * @method $this msetnx(array $dictionary)
  50. * @method $this psetex($key, $milliseconds, $value)
  51. * @method $this set($key, $value, $expireResolution = null, $expireTTL = null, $flag = null)
  52. * @method $this setbit($key, $offset, $value)
  53. * @method $this setex($key, $seconds, $value)
  54. * @method $this setnx($key, $value)
  55. * @method $this setrange($key, $offset, $value)
  56. * @method $this strlen($key)
  57. * @method $this hdel($key, array $fields)
  58. * @method $this hexists($key, $field)
  59. * @method $this hget($key, $field)
  60. * @method $this hgetall($key)
  61. * @method $this hincrby($key, $field, $increment)
  62. * @method $this hincrbyfloat($key, $field, $increment)
  63. * @method $this hkeys($key)
  64. * @method $this hlen($key)
  65. * @method $this hmget($key, array $fields)
  66. * @method $this hmset($key, array $dictionary)
  67. * @method $this hscan($key, $cursor, array $options = null)
  68. * @method $this hset($key, $field, $value)
  69. * @method $this hsetnx($key, $field, $value)
  70. * @method $this hvals($key)
  71. * @method $this hstrlen($key, $field)
  72. * @method $this blpop(array $keys, $timeout)
  73. * @method $this brpop(array $keys, $timeout)
  74. * @method $this brpoplpush($source, $destination, $timeout)
  75. * @method $this lindex($key, $index)
  76. * @method $this linsert($key, $whence, $pivot, $value)
  77. * @method $this llen($key)
  78. * @method $this lpop($key)
  79. * @method $this lpush($key, array $values)
  80. * @method $this lpushx($key, $value)
  81. * @method $this lrange($key, $start, $stop)
  82. * @method $this lrem($key, $count, $value)
  83. * @method $this lset($key, $index, $value)
  84. * @method $this ltrim($key, $start, $stop)
  85. * @method $this rpop($key)
  86. * @method $this rpoplpush($source, $destination)
  87. * @method $this rpush($key, array $values)
  88. * @method $this rpushx($key, $value)
  89. * @method $this sadd($key, array $members)
  90. * @method $this scard($key)
  91. * @method $this sdiff(array $keys)
  92. * @method $this sdiffstore($destination, array $keys)
  93. * @method $this sinter(array $keys)
  94. * @method $this sinterstore($destination, array $keys)
  95. * @method $this sismember($key, $member)
  96. * @method $this smembers($key)
  97. * @method $this smove($source, $destination, $member)
  98. * @method $this spop($key, $count = null)
  99. * @method $this srandmember($key, $count = null)
  100. * @method $this srem($key, $member)
  101. * @method $this sscan($key, $cursor, array $options = null)
  102. * @method $this sunion(array $keys)
  103. * @method $this sunionstore($destination, array $keys)
  104. * @method $this zadd($key, array $membersAndScoresDictionary)
  105. * @method $this zcard($key)
  106. * @method $this zcount($key, $min, $max)
  107. * @method $this zincrby($key, $increment, $member)
  108. * @method $this zinterstore($destination, array $keys, array $options = null)
  109. * @method $this zrange($key, $start, $stop, array $options = null)
  110. * @method $this zrangebyscore($key, $min, $max, array $options = null)
  111. * @method $this zrank($key, $member)
  112. * @method $this zrem($key, $member)
  113. * @method $this zremrangebyrank($key, $start, $stop)
  114. * @method $this zremrangebyscore($key, $min, $max)
  115. * @method $this zrevrange($key, $start, $stop, array $options = null)
  116. * @method $this zrevrangebyscore($key, $min, $max, array $options = null)
  117. * @method $this zrevrank($key, $member)
  118. * @method $this zunionstore($destination, array $keys, array $options = null)
  119. * @method $this zscore($key, $member)
  120. * @method $this zscan($key, $cursor, array $options = null)
  121. * @method $this zrangebylex($key, $start, $stop, array $options = null)
  122. * @method $this zrevrangebylex($key, $start, $stop, array $options = null)
  123. * @method $this zremrangebylex($key, $min, $max)
  124. * @method $this zlexcount($key, $min, $max)
  125. * @method $this pfadd($key, array $elements)
  126. * @method $this pfmerge($destinationKey, array $sourceKeys)
  127. * @method $this pfcount(array $keys)
  128. * @method $this pubsub($subcommand, $argument)
  129. * @method $this publish($channel, $message)
  130. * @method $this discard()
  131. * @method $this exec()
  132. * @method $this multi()
  133. * @method $this unwatch()
  134. * @method $this watch($key)
  135. * @method $this eval($script, $numkeys, $keyOrArg1 = null, $keyOrArgN = null)
  136. * @method $this evalsha($script, $numkeys, $keyOrArg1 = null, $keyOrArgN = null)
  137. * @method $this script($subcommand, $argument = null)
  138. * @method $this auth($password)
  139. * @method $this echo($message)
  140. * @method $this ping($message = null)
  141. * @method $this select($database)
  142. * @method $this bgrewriteaof()
  143. * @method $this bgsave()
  144. * @method $this client($subcommand, $argument = null)
  145. * @method $this config($subcommand, $argument = null)
  146. * @method $this dbsize()
  147. * @method $this flushall()
  148. * @method $this flushdb()
  149. * @method $this info($section = null)
  150. * @method $this lastsave()
  151. * @method $this save()
  152. * @method $this slaveof($host, $port)
  153. * @method $this slowlog($subcommand, $argument = null)
  154. * @method $this time()
  155. * @method $this command()
  156. * @method $this geoadd($key, $longitude, $latitude, $member)
  157. * @method $this geohash($key, array $members)
  158. * @method $this geopos($key, array $members)
  159. * @method $this geodist($key, $member1, $member2, $unit = null)
  160. * @method $this georadius($key, $longitude, $latitude, $radius, $unit, array $options = null)
  161. * @method $this georadiusbymember($key, $member, $radius, $unit, array $options = null)
  162. *
  163. * @author Daniele Alessandri <suppakilla@gmail.com>
  164. */
  165. interface ClientContextInterface
  166. {
  167. /**
  168. * Sends the specified command instance to Redis.
  169. *
  170. * @param CommandInterface $command Command instance.
  171. *
  172. * @return mixed
  173. */
  174. public function executeCommand(CommandInterface $command);
  175. /**
  176. * Sends the specified command with its arguments to Redis.
  177. *
  178. * @param string $method Command ID.
  179. * @param array $arguments Arguments for the command.
  180. *
  181. * @return mixed
  182. */
  183. public function __call($method, $arguments);
  184. /**
  185. * Starts the execution of the context.
  186. *
  187. * @param mixed $callable Optional callback for execution.
  188. *
  189. * @return array
  190. */
  191. public function execute($callable = null);
  192. }