ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilMemcacheServer.php
Go to the documentation of this file.
1<?php
2require_once('./Services/ActiveRecord/class.ActiveRecord.php');
3
11{
12 const STATUS_INACTIVE = -1;
13 const STATUS_ACTIVE = 1;
14
15
21 public static function returnDbTableName()
22 {
23 return 'il_gc_memcache_server';
24 }
25
26
30 public function isActive()
31 {
32 return $this->getStatus() == self::STATUS_ACTIVE;
33 }
34
35
39 public function isReachable()
40 {
41 $mem = new Memcached();
42 $mem->resetServerList();
43 $mem->addServer($this->getHost(), $this->getPort(), $this->getWeight());
44 $stats = $mem->getStats();
45
46 return $stats[$this->getHost() . ':' . $this->getPort()]['pid'] > 0;
47 }
48
49
60 protected $id = 0;
76 protected $host = '';
84 protected $port = 0;
92 protected $weight = 100;
100 protected $flush_needed = false;
101
102
106 public function getId()
107 {
108 return $this->id;
109 }
110
111
115 public function setId($id)
116 {
117 $this->id = $id;
118 }
119
120
124 public function getStatus()
125 {
126 return $this->status;
127 }
128
129
133 public function setStatus($status)
134 {
135 $this->status = $status;
136 }
137
138
142 public function getHost()
143 {
144 return $this->host;
145 }
146
147
151 public function setHost($host)
152 {
153 $this->host = $host;
154 }
155
156
160 public function getPort()
161 {
162 return $this->port;
163 }
164
165
169 public function setPort($port)
170 {
171 $this->port = $port;
172 }
173
174
178 public function getFlushNeeded()
179 {
180 return $this->flush_needed;
181 }
182
183
188 {
189 $this->flush_needed = $flush_needed;
190 }
191
192
196 public function getWeight()
197 {
198 return $this->weight;
199 }
200
201
205 public function setWeight($weight)
206 {
207 $this->weight = $weight;
208 }
209}
Class ActiveRecord.
An exception for terminatinating execution or to throw for unit testing.
Class ilMemcacheServer.
setFlushNeeded($flush_needed)