MemCacheServer.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\caching;
  8. /**
  9. * MemCacheServer represents the configuration data for a single memcache or memcached server.
  10. *
  11. * See [PHP manual](https://secure.php.net/manual/en/memcache.addserver.php) for detailed explanation
  12. * of each configuration property.
  13. *
  14. * For more details and usage information on Cache, see the [guide article on caching](guide:caching-overview).
  15. *
  16. * @author Qiang Xue <qiang.xue@gmail.com>
  17. * @since 2.0
  18. */
  19. class MemCacheServer extends \yii\base\BaseObject
  20. {
  21. /**
  22. * @var string memcache server hostname or IP address
  23. */
  24. public $host;
  25. /**
  26. * @var int memcache server port
  27. */
  28. public $port = 11211;
  29. /**
  30. * @var int probability of using this server among all servers.
  31. */
  32. public $weight = 1;
  33. /**
  34. * @var bool whether to use a persistent connection. This is used by memcache only.
  35. */
  36. public $persistent = true;
  37. /**
  38. * @var int timeout in milliseconds which will be used for connecting to the server.
  39. * This is used by memcache only. For old versions of memcache that only support specifying
  40. * timeout in seconds this will be rounded up to full seconds.
  41. */
  42. public $timeout = 1000;
  43. /**
  44. * @var int how often a failed server will be retried (in seconds). This is used by memcache only.
  45. */
  46. public $retryInterval = 15;
  47. /**
  48. * @var bool if the server should be flagged as online upon a failure. This is used by memcache only.
  49. */
  50. public $status = true;
  51. /**
  52. * @var \Closure this callback function will run upon encountering an error.
  53. * The callback is run before fail over is attempted. The function takes two parameters,
  54. * the [[host]] and the [[port]] of the failed server.
  55. * This is used by memcache only.
  56. */
  57. public $failureCallback;
  58. }