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 MemcacheCacheConfig extends AbstractConfig
14: {
15: /**
16: * @var string $host
17: */
18: public $host;
19:
20: /**
21: * @var integer $port
22: */
23: public $port;
24:
25: /**
26: * @var boolean $persistent
27: */
28: public $persistent;
29:
30: /**
31: * @var integer $weight
32: */
33: public $weight;
34:
35: /**
36: * @return array
37: */
38: public function defaults()
39: {
40: return [
41: 'host' => 'localhost',
42: 'port' => 11211,
43: 'persistent' => true,
44: 'weight' => 1
45: ];
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: