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.

59 line
1.8KB

  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](http://www.php.net/manual/en/function.Memcache-addServer.php) for detailed explanation
  12. * of each configuration property.
  13. *
  14. * @author Qiang Xue <qiang.xue@gmail.com>
  15. * @since 2.0
  16. */
  17. class MemCacheServer extends \yii\base\Object
  18. {
  19. /**
  20. * @var string memcache server hostname or IP address
  21. */
  22. public $host;
  23. /**
  24. * @var integer memcache server port
  25. */
  26. public $port = 11211;
  27. /**
  28. * @var integer probability of using this server among all servers.
  29. */
  30. public $weight = 1;
  31. /**
  32. * @var boolean whether to use a persistent connection. This is used by memcache only.
  33. */
  34. public $persistent = true;
  35. /**
  36. * @var integer timeout in milliseconds which will be used for connecting to the server.
  37. * This is used by memcache only. For old versions of memcache that only support specifying
  38. * timeout in seconds this will be rounded up to full seconds.
  39. */
  40. public $timeout = 1000;
  41. /**
  42. * @var integer how often a failed server will be retried (in seconds). This is used by memcache only.
  43. */
  44. public $retryInterval = 15;
  45. /**
  46. * @var boolean if the server should be flagged as online upon a failure. This is used by memcache only.
  47. */
  48. public $status = true;
  49. /**
  50. * @var \Closure this callback function will run upon encountering an error.
  51. * The callback is run before fail over is attempted. The function takes two parameters,
  52. * the [[host]] and the [[port]] of the failed server.
  53. * This is used by memcache only.
  54. */
  55. public $failureCallback;
  56. }