ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
StorageConvenience.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Setup\Metrics;
22
24
29{
30 abstract public function store(string $key, M $metric): void;
31
32 public function storeConfigBool(string $key, bool $value, ?string $description = null): void
33 {
34 $this->store(
35 $key,
36 new M(M::STABILITY_CONFIG, M::TYPE_BOOL, $value, $description)
37 );
38 }
39
40 public function storeConfigCounter(string $key, int $value, ?string $description = null): void
41 {
42 $this->store(
43 $key,
44 new M(M::STABILITY_CONFIG, M::TYPE_COUNTER, $value, $description)
45 );
46 }
47
48 public function storeConfigGauge(string $key, $value, ?string $description = null): void
49 {
50 $this->store(
51 $key,
52 new M(M::STABILITY_CONFIG, M::TYPE_GAUGE, $value, $description)
53 );
54 }
55
56 public function storeConfigTimestamp(string $key, \DateTimeImmutable $value, ?string $description = null): void
57 {
58 $this->store(
59 $key,
60 new M(M::STABILITY_CONFIG, M::TYPE_TIMESTAMP, $value, $description)
61 );
62 }
63
64 public function storeConfigText(string $key, string $value, ?string $description = null): void
65 {
66 $this->store(
67 $key,
68 new M(M::STABILITY_CONFIG, M::TYPE_TEXT, $value, $description)
69 );
70 }
71
72
73 public function storeStableBool(string $key, bool $value, ?string $description = null): void
74 {
75 $this->store(
76 $key,
77 new M(M::STABILITY_STABLE, M::TYPE_BOOL, $value, $description)
78 );
79 }
80
81 public function storeStableCounter(string $key, int $value, ?string $description = null): void
82 {
83 $this->store(
84 $key,
85 new M(M::STABILITY_STABLE, M::TYPE_COUNTER, $value, $description)
86 );
87 }
88
89 public function storeStableGauge(string $key, $value, ?string $description = null): void
90 {
91 $this->store(
92 $key,
93 new M(M::STABILITY_STABLE, M::TYPE_GAUGE, $value, $description)
94 );
95 }
96
97 public function storeStableTimestamp(string $key, \DateTimeImmutable $value, ?string $description = null): void
98 {
99 $this->store(
100 $key,
101 new M(M::STABILITY_STABLE, M::TYPE_TIMESTAMP, $value, $description)
102 );
103 }
104
105 public function storeStableText(string $key, string $value, ?string $description = null): void
106 {
107 $this->store(
108 $key,
109 new M(M::STABILITY_STABLE, M::TYPE_TEXT, $value, $description)
110 );
111 }
112
113
114 public function storeVolatileBool(string $key, bool $value, ?string $description = null): void
115 {
116 $this->store(
117 $key,
118 new M(M::STABILITY_VOLATILE, M::TYPE_BOOL, $value, $description)
119 );
120 }
121
122 public function storeVolatileCounter(string $key, int $value, ?string $description = null): void
123 {
124 $this->store(
125 $key,
126 new M(M::STABILITY_VOLATILE, M::TYPE_COUNTER, $value, $description)
127 );
128 }
129
130 public function storeVolatileGauge(string $key, $value, ?string $description = null): void
131 {
132 $this->store(
133 $key,
134 new M(M::STABILITY_VOLATILE, M::TYPE_GAUGE, $value, $description)
135 );
136 }
137
138 public function storeVolatileTimestamp(string $key, \DateTimeImmutable $value, ?string $description = null): void
139 {
140 $this->store(
141 $key,
142 new M(M::STABILITY_VOLATILE, M::TYPE_TIMESTAMP, $value, $description)
143 );
144 }
145
146 public function storeVolatileText(string $key, string $value, ?string $description = null): void
147 {
148 $this->store(
149 $key,
150 new M(M::STABILITY_VOLATILE, M::TYPE_TEXT, $value, $description)
151 );
152 }
153}
A metric is something we can measure about the system.
Definition: Metric.php:34
storeConfigText(string $key, string $value, ?string $description=null)
storeVolatileTimestamp(string $key, \DateTimeImmutable $value, ?string $description=null)
storeVolatileText(string $key, string $value, ?string $description=null)
storeStableTimestamp(string $key, \DateTimeImmutable $value, ?string $description=null)
storeConfigCounter(string $key, int $value, ?string $description=null)
trait StorageConvenience
Implements the convenience methods of Storage over Storage::store.
storeConfigTimestamp(string $key, \DateTimeImmutable $value, ?string $description=null)
storeConfigGauge(string $key, $value, ?string $description=null)
storeVolatileGauge(string $key, $value, ?string $description=null)
storeStableGauge(string $key, $value, ?string $description=null)
storeConfigBool(string $key, bool $value, ?string $description=null)
storeStableCounter(string $key, int $value, ?string $description=null)
storeStableText(string $key, string $value, ?string $description=null)
storeVolatileBool(string $key, bool $value, ?string $description=null)
storeStableBool(string $key, bool $value, ?string $description=null)
storeVolatileCounter(string $key, int $value, ?string $description=null)