ILIAS  release_7 Revision v7.30-3-g800a261c036
StorageConvenience.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2020 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5namespace ILIAS\Setup\Metrics;
6
8
13{
14 abstract public function store(string $key, M $metric) : void;
15
16 public function storeConfigBool($key, bool $value, string $description = null) : void
17 {
18 $this->store(
19 $key,
20 new M(M::STABILITY_CONFIG, M::TYPE_BOOL, $value, $description)
21 );
22 }
23
24 public function storeConfigCounter($key, int $value, string $description = null) : void
25 {
26 $this->store(
27 $key,
28 new M(M::STABILITY_CONFIG, M::TYPE_COUNTER, $value, $description)
29 );
30 }
31
32 public function storeConfigGauge($key, $value, string $description = null) : void
33 {
34 $this->store(
35 $key,
36 new M(M::STABILITY_CONFIG, M::TYPE_GAUGE, $value, $description)
37 );
38 }
39
40 public function storeConfigTimestamp($key, \DateTimeImmutable $value, string $description = null) : void
41 {
42 $this->store(
43 $key,
44 new M(M::STABILITY_CONFIG, M::TYPE_TIMESTAMP, $value, $description)
45 );
46 }
47
48 public function storeConfigText($key, string $value, string $description = null) : void
49 {
50 $this->store(
51 $key,
52 new M(M::STABILITY_CONFIG, M::TYPE_TEXT, $value, $description)
53 );
54 }
55
56
57 public function storeStableBool($key, bool $value, string $description = null) : void
58 {
59 $this->store(
60 $key,
61 new M(M::STABILITY_STABLE, M::TYPE_BOOL, $value, $description)
62 );
63 }
64
65 public function storeStableCounter($key, int $value, string $description = null) : void
66 {
67 $this->store(
68 $key,
69 new M(M::STABILITY_STABLE, M::TYPE_COUNTER, $value, $description)
70 );
71 }
72
73 public function storeStableGauge($key, $value, string $description = null) : void
74 {
75 $this->store(
76 $key,
77 new M(M::STABILITY_STABLE, M::TYPE_GAUGE, $value, $description)
78 );
79 }
80
81 public function storeStableTimestamp($key, \DateTimeImmutable $value, string $description = null) : void
82 {
83 $this->store(
84 $key,
85 new M(M::STABILITY_STABLE, M::TYPE_TIMESTAMP, $value, $description)
86 );
87 }
88
89 public function storeStableText($key, string $value, string $description = null) : void
90 {
91 $this->store(
92 $key,
93 new M(M::STABILITY_STABLE, M::TYPE_TEXT, $value, $description)
94 );
95 }
96
97
98 public function storeVolatileBool($key, bool $value, string $description = null) : void
99 {
100 $this->store(
101 $key,
102 new M(M::STABILITY_VOLATILE, M::TYPE_BOOL, $value, $description)
103 );
104 }
105
106 public function storeVolatileCounter($key, int $value, string $description = null) : void
107 {
108 $this->store(
109 $key,
110 new M(M::STABILITY_VOLATILE, M::TYPE_COUNTER, $value, $description)
111 );
112 }
113
114 public function storeVolatileGauge($key, $value, string $description = null) : void
115 {
116 $this->store(
117 $key,
118 new M(M::STABILITY_VOLATILE, M::TYPE_GAUGE, $value, $description)
119 );
120 }
121
122 public function storeVolatileTimestamp($key, \DateTimeImmutable $value, string $description = null) : void
123 {
124 $this->store(
125 $key,
126 new M(M::STABILITY_VOLATILE, M::TYPE_TIMESTAMP, $value, $description)
127 );
128 }
129
130 public function storeVolatileText($key, string $value, string $description = null) : void
131 {
132 $this->store(
133 $key,
134 new M(M::STABILITY_VOLATILE, M::TYPE_TEXT, $value, $description)
135 );
136 }
137}
An exception for terminatinating execution or to throw for unit testing.
A metric is something we can measure about the system.
Definition: Metric.php:18
storeVolatileCounter($key, int $value, string $description=null)
storeConfigGauge($key, $value, string $description=null)
storeVolatileGauge($key, $value, string $description=null)
storeStableText($key, string $value, string $description=null)
storeConfigTimestamp($key, \DateTimeImmutable $value, string $description=null)
storeConfigCounter($key, int $value, string $description=null)
storeVolatileTimestamp($key, \DateTimeImmutable $value, string $description=null)
storeStableBool($key, bool $value, string $description=null)
trait StorageConvenience
Implements the convenience methods of Storage over Storage::store.
storeStableTimestamp($key, \DateTimeImmutable $value, string $description=null)
storeConfigBool($key, bool $value, string $description=null)
storeStableGauge($key, $value, string $description=null)
storeConfigText($key, string $value, string $description=null)
storeVolatileBool($key, bool $value, string $description=null)
storeVolatileText($key, string $value, string $description=null)
storeStableCounter($key, int $value, string $description=null)