Redis61ProxyTrait.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.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 Symfony\Component\Cache\Traits;
  11. if (version_compare(phpversion('redis'), '6.1.0-dev', '>=')) {
  12. /**
  13. * @internal
  14. */
  15. trait Redis61ProxyTrait
  16. {
  17. public function dump($key): \Redis|string|false
  18. {
  19. return $this->initializeLazyObject()->dump(...\func_get_args());
  20. }
  21. public function hRandField($key, $options = null): \Redis|array|string|false
  22. {
  23. return $this->initializeLazyObject()->hRandField(...\func_get_args());
  24. }
  25. public function hSet($key, ...$fields_and_vals): \Redis|false|int
  26. {
  27. return $this->initializeLazyObject()->hSet(...\func_get_args());
  28. }
  29. public function mget($keys): \Redis|array|false
  30. {
  31. return $this->initializeLazyObject()->mget(...\func_get_args());
  32. }
  33. public function sRandMember($key, $count = 0): mixed
  34. {
  35. return $this->initializeLazyObject()->sRandMember(...\func_get_args());
  36. }
  37. public function waitaof($numlocal, $numreplicas, $timeout): \Redis|array|false
  38. {
  39. return $this->initializeLazyObject()->waitaof(...\func_get_args());
  40. }
  41. }
  42. } else {
  43. /**
  44. * @internal
  45. */
  46. trait Redis61ProxyTrait
  47. {
  48. public function dump($key): \Redis|string
  49. {
  50. return $this->initializeLazyObject()->dump(...\func_get_args());
  51. }
  52. public function hRandField($key, $options = null): \Redis|array|string
  53. {
  54. return $this->initializeLazyObject()->hRandField(...\func_get_args());
  55. }
  56. public function hSet($key, $member, $value): \Redis|false|int
  57. {
  58. return $this->initializeLazyObject()->hSet(...\func_get_args());
  59. }
  60. public function mget($keys): \Redis|array
  61. {
  62. return $this->initializeLazyObject()->mget(...\func_get_args());
  63. }
  64. public function sRandMember($key, $count = 0): \Redis|array|false|string
  65. {
  66. return $this->initializeLazyObject()->sRandMember(...\func_get_args());
  67. }
  68. }
  69. }