MediaWiki
REL1_39
SerializedValueContainer.php
Go to the documentation of this file.
1
<?php
2
8
class
SerializedValueContainer
{
9
private
const
SCHEMA =
'__svc_schema__'
;
10
// 64 bit UID
11
private
const
SCHEMA_UNIFIED =
'DAAIDgoKAQw'
;
12
// 64 bit UID
13
private
const
SCHEMA_SEGMENTED =
'CAYCDAgCDw4'
;
14
15
public
const
UNIFIED_DATA
=
'__data__'
;
16
public
const
SEGMENTED_HASHES
=
'__hashes__'
;
17
22
public
static
function
newUnified
(
$serialized
) {
23
return
(
object
)[
24
self::SCHEMA => self::SCHEMA_UNIFIED,
25
self::UNIFIED_DATA =>
$serialized
26
];
27
}
28
33
public
static
function
newSegmented
( array $segmentHashList ) {
34
return
(
object
)[
35
self::SCHEMA => self::SCHEMA_SEGMENTED,
36
self::SEGMENTED_HASHES => $segmentHashList
37
];
38
}
39
44
public
static
function
isUnified
( $value ) {
45
return
(
46
$value instanceof stdClass &&
47
( $value->{self::SCHEMA} ?? null ) === self::SCHEMA_UNIFIED
48
);
49
}
50
55
public
static
function
isSegmented
( $value ) {
56
return
(
57
$value instanceof stdClass &&
58
( $value->{self::SCHEMA} ?? null ) === self::SCHEMA_SEGMENTED
59
);
60
}
61
}
SerializedValueContainer
Helper class for segmenting large cache values without relying on serializing classes.
Definition
SerializedValueContainer.php:8
SerializedValueContainer\UNIFIED_DATA
const UNIFIED_DATA
Definition
SerializedValueContainer.php:15
SerializedValueContainer\SEGMENTED_HASHES
const SEGMENTED_HASHES
Definition
SerializedValueContainer.php:16
SerializedValueContainer\newSegmented
static newSegmented(array $segmentHashList)
Definition
SerializedValueContainer.php:33
SerializedValueContainer\isSegmented
static isSegmented( $value)
Definition
SerializedValueContainer.php:55
SerializedValueContainer\isUnified
static isUnified( $value)
Definition
SerializedValueContainer.php:44
SerializedValueContainer\newUnified
static newUnified( $serialized)
Definition
SerializedValueContainer.php:22
$serialized
foreach( $res as $row) $serialized
Definition
testCompression.php:88
includes
libs
objectcache
serialized
SerializedValueContainer.php
Generated on Fri Dec 20 2024 15:34:39 for MediaWiki by
1.10.0