MediaWiki REL1_39
SerializedValueContainer.php
Go to the documentation of this file.
1<?php
2
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}
Helper class for segmenting large cache values without relying on serializing classes.
static newSegmented(array $segmentHashList)
foreach( $res as $row) $serialized