shared.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. if (PHP_SAPI !== 'cli') {
  11. die("Example scripts are meant to be executed locally via CLI.");
  12. }
  13. require __DIR__.'/../autoload.php';
  14. function redis_version($info)
  15. {
  16. if (isset($info['Server']['redis_version'])) {
  17. return $info['Server']['redis_version'];
  18. } elseif (isset($info['redis_version'])) {
  19. return $info['redis_version'];
  20. } else {
  21. return 'unknown version';
  22. }
  23. }
  24. $single_server = array(
  25. 'host' => '127.0.0.1',
  26. 'port' => 6379,
  27. 'database' => 15,
  28. );
  29. $multiple_servers = array(
  30. array(
  31. 'host' => '127.0.0.1',
  32. 'port' => 6379,
  33. 'database' => 15,
  34. 'alias' => 'first',
  35. ),
  36. array(
  37. 'host' => '127.0.0.1',
  38. 'port' => 6380,
  39. 'database' => 15,
  40. 'alias' => 'second',
  41. ),
  42. );