ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilMemcacheServer.php
Go to the documentation of this file.
1 <?php
2 require_once('./Services/ActiveRecord/class.ActiveRecord.php');
3 
11 
12  const STATUS_INACTIVE = - 1;
13  const STATUS_ACTIVE = 1;
14 
15 
21  static function returnDbTableName() {
22  return 'il_gc_memcache_server';
23  }
24 
25 
29  public function isActive() {
30  return $this->getStatus() == self::STATUS_ACTIVE;
31  }
32 
33 
37  public function isReachable() {
38  $mem = new Memcached();
39  $mem->resetServerList();
40  $mem->addServer($this->getHost(), $this->getPort(), $this->getWeight());
41  $stats = $mem->getStats();
42 
43  return $stats[$this->getHost() . ':' . $this->getPort()]['pid'] > 0;
44  }
45 
46 
57  protected $id = 0;
65  protected $status = self::STATUS_INACTIVE;
73  protected $host = '';
81  protected $port = 0;
89  protected $weight = 100;
97  protected $flush_needed = false;
98 
99 
103  public function getId() {
104  return $this->id;
105  }
106 
107 
111  public function setId($id) {
112  $this->id = $id;
113  }
114 
115 
119  public function getStatus() {
120  return $this->status;
121  }
122 
123 
127  public function setStatus($status) {
128  $this->status = $status;
129  }
130 
131 
135  public function getHost() {
136  return $this->host;
137  }
138 
139 
143  public function setHost($host) {
144  $this->host = $host;
145  }
146 
147 
151  public function getPort() {
152  return $this->port;
153  }
154 
155 
159  public function setPort($port) {
160  $this->port = $port;
161  }
162 
163 
167  public function getFlushNeeded() {
168  return $this->flush_needed;
169  }
170 
171 
175  public function setFlushNeeded($flush_needed) {
176  $this->flush_needed = $flush_needed;
177  }
178 
179 
183  public function getWeight() {
184  return $this->weight;
185  }
186 
187 
191  public function setWeight($weight) {
192  $this->weight = $weight;
193  }
194 }
195 
196 ?>
Class ActiveRecord.
setFlushNeeded($flush_needed)
Class ilMemcacheServer.