1: <?php
2:
3: namespace Charcoal\App\Config;
4:
5: // Local parent namespace dependencies
6: use \Charcoal\Config\AbstractConfig;
7:
8: /**
9: * Memcache Cache Server Config
10: *
11: * Defines a memcache server configuration.
12: */
13: class MemcacheCacheServerConfig extends AbstractConfig
14: {
15: /**
16: * @var string $host
17: */
18: public $host;
19: /**
20: * @var integer $port
21: */
22: public $port;
23: /**
24: * @var boolean $persistent
25: */
26: public $persistent;
27: /**
28: * @var integer $weight
29: */
30: public $weight;
31:
32: /**
33: * @return array
34: */
35: public function defaults()
36: {
37: $defaults = [
38: 'host' => 'localhost',
39: 'port' => 11211,
40: 'persistent' => true,
41: 'weight' => 1
42: ];
43:
44: $defaults = array_merge(parent::defaults(), $defaults);
45: return $defaults;
46: }
47:
48: /**
49: * @param string $host The memcache server host.
50: * @return MemcacheCacheServerConfig Chainable.
51: */
52: public function setHost($host)
53: {
54: $this->host = $host;
55: return $this;
56: }
57:
58: /**
59: * @return string
60: */
61: public function host()
62: {
63: return $this->host;
64: }
65:
66: /**
67: * @param integer $port The memcache server port.
68: * @return MemcacheCacheServerConfig Chainable
69: */
70: public function setPort($port)
71: {
72: $this->port = $port;
73: return $this;
74: }
75:
76: /**
77: * @return integer
78: */
79: public function port()
80: {
81: return $this->port;
82: }
83:
84: /**
85: * @param boolean $persistent The persistent flag.
86: * @return MemcacheCacheServerConfig Chainable
87: */
88: public function setPersistent($persistent)
89: {
90: $this->persistent = $persistent;
91: return $this;
92: }
93:
94: /**
95: * @return boolean
96: */
97: public function persistent()
98: {
99: return $this->persistent;
100: }
101:
102: /**
103: * @param integer $weight The weight of this server, relative to other's weight.
104: * @return MemcacheCacheServerConfig Chainable
105: */
106: public function setWeight($weight)
107: {
108: $this->weight = $weight;
109: return $this;
110: }
111:
112: /**
113: * @return integer
114: */
115: public function weight()
116: {
117: return $this->weight;
118: }
119: }
120: