1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
redis.php
См. документацию.
1<?php
2
4use Bitrix\Cluster\ClusterCacheConfig;
6
8
10{
11 public static null|bool $systemConfigurationUpdate = null;
12 protected static string $type = 'redis';
13
14 public static function saveConfig($servers): void
15 {
16 self::$systemConfigurationUpdate = ClusterCacheConfig::getInstance('redis')->saveConfig(
17 $servers,
18 [
19 'type' => [
20 'class_name' => 'CPHPCacheRedisCluster',
21 'extension' => 'redis',
22 'required_file' => 'modules/cluster/classes/general/redis_cache.php',
23 ],
24 'failover' => Option::get('cluster', 'failower_settings'),
25 'timeout' => Option::get('cluster', 'redis_timeoit'),
26 'read_timeout' => Option::get('cluster', 'redis_read_timeout'),
27 'persistent' => (Option::get('cluster', 'redis_persistent') === 'Y'),
28 ],
29 'CPHPCacheRedisCluster'
30 );
31 }
32
33 public static function getStatus($server): array
34 {
35 $stats = [
36 'message' => null,
37 'redis_version' => null,
38 'redis_mode' => null,
39 'os' => null,
40 'uptime_in_seconds' => null,
41 'connected_clients' => null,
42 'total_system_memory' => null,
43 'used_memory' => null,
44 'maxmemory' => null,
45 'maxmemory_policy' => null,
46 'mem_fragmentation_ratio' => null,
47 'loading' => null,
48 'keyspace_hits' => null,
49 'keyspace_misses' => null,
50 'evicted_keys' => null,
51 'expired_keys' => null,
52 'expired_stale_perc' => null,
53 'used_cpu_sys' => null,
54 'used_cpu_user' => null,
55 'used_cpu_sys_children' => null,
56 'used_cpu_user_children' => null,
57 'role' => null,
58 'cluster_enabled' => null,
59 'connected_slaves' => null,
60 'master_replid' => null,
61 'master_replid2' => null,
62 'master_repl_offset' => null,
63 'slave_expires_tracked_keys' => null
64 ];
65
66 if (is_array($server))
67 {
68 try
69 {
70 $redis = new \Redis();
71 if (@$redis->connect($server['HOST'], $server['PORT']))
72 {
73 $info = $redis->info();
74 foreach ($stats as $key => $_)
75 {
76 $stats[$key] = $info[$key];
77 }
78 }
79
80 $stats['uptime'] = $stats['uptime_in_seconds'];
81 }
82 catch (RedisException $e)
83 {
84 $stats['message'] = $e->getMessage();
85 }
86 }
87
88 return $stats;
89 }
90}
Определения redis.php:10
static null bool $systemConfigurationUpdate
Определения redis.php:11
static saveConfig($servers)
Определения redis.php:14
static string $type
Определения redis.php:12
static getStatus($server)
Определения redis.php:33
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if($NS['step']==6) if( $NS[ 'step']==7) if(COption::GetOptionInt('main', 'disk_space', 0) > 0) $info
Определения backup.php:924
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
if(empty($signedUserToken)) $key
Определения quickway.php:257