ILIAS  release_8 Revision v8.24
class.ilMemcacheServer.php
Go to the documentation of this file.
1<?php
2
25{
29 public const STATUS_INACTIVE = 0;
33 public const STATUS_ACTIVE = 1;
34
39 public static function returnDbTableName(): string
40 {
41 return 'il_gc_memcache_server';
42 }
43
44 public function isActive(): bool
45 {
46 return $this->getStatus() === self::STATUS_ACTIVE;
47 }
48
49 public function isReachable(): bool
50 {
51 $mem = new Memcached();
52 $mem->resetServerList();
53 $mem->addServer($this->getHost(), $this->getPort(), $this->getWeight());
54
55 $stats = $mem->getStats();
56
57 return $stats[$this->getHost() . ':' . $this->getPort()]['pid'] > 0;
58 }
59
68 protected ?int $id = 0;
81 protected string $host = '';
87 protected int $port = 0;
93 protected int $weight = 100;
100 protected $flush_needed = false;
101
102 public function getId(): int
103 {
104 return $this->id;
105 }
106
107 public function setId(int $id): void
108 {
109 $this->id = $id;
110 }
111
112 public function getStatus(): int
113 {
114 return $this->status;
115 }
116
117 public function setStatus(int $status): void
118 {
119 $this->status = $status;
120 }
121
122 public function getHost(): string
123 {
124 return $this->host;
125 }
126
127 public function setHost(string $host): void
128 {
129 $this->host = $host;
130 }
131
132 public function getPort(): int
133 {
134 return $this->port;
135 }
136
137 public function setPort(int $port): void
138 {
139 $this->port = $port;
140 }
141
142 public function getFlushNeeded(): string
143 {
144 return $this->flush_needed;
145 }
146
147 public function setFlushNeeded(string $flush_needed): void
148 {
149 $this->flush_needed = $flush_needed;
150 }
151
152 public function getWeight(): int
153 {
154 return $this->weight;
155 }
156
157 public function setWeight(int $weight): void
158 {
159 $this->weight = $weight;
160 }
161}
Class ActiveRecord.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
int $weight
@con_has_field true @con_fieldtype integer @con_length 2
string $host
@con_has_field true @con_fieldtype text @con_length 256
int $port
@con_has_field true @con_fieldtype integer @con_length 8
static returnDbTableName()
@description Return the Name of your Database Table
int $id
@con_is_primary true @con_is_unique true @con_has_field true @con_fieldtype integer @con_length 8 @co...
setFlushNeeded(string $flush_needed)