MediaWiki REL1_34
BlobStoreFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Storage;
22
27
36
40 private $lbFactory;
41
46
50 private $cache;
51
55 private $options;
56
61 public const CONSTRUCTOR_OPTIONS = [
62 'CompressRevisions',
63 'DefaultExternalStore',
64 'LegacyEncoding',
65 'RevisionCacheExpiry',
66 ];
67
68 public function __construct(
73 ) {
74 $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
75
76 $this->lbFactory = $lbFactory;
77 $this->extStoreAccess = $extStoreAccess;
78 $this->cache = $cache;
79 $this->options = $options;
80 }
81
89 public function newBlobStore( $dbDomain = false ) {
90 return $this->newSqlBlobStore( $dbDomain );
91 }
92
100 public function newSqlBlobStore( $dbDomain = false ) {
101 $lb = $this->lbFactory->getMainLB( $dbDomain );
102 $store = new SqlBlobStore(
103 $lb,
104 $this->extStoreAccess,
105 $this->cache,
106 $dbDomain
107 );
108
109 $store->setCompressBlobs( $this->options->get( 'CompressRevisions' ) );
110 $store->setCacheExpiry( $this->options->get( 'RevisionCacheExpiry' ) );
111 $store->setUseExternalStore( $this->options->get( 'DefaultExternalStore' ) !== false );
112
113 if ( $this->options->get( 'LegacyEncoding' ) ) {
114 $store->setLegacyEncoding( $this->options->get( 'LegacyEncoding' ) );
115 }
116
117 return $store;
118 }
119
120}
Key/value blob storage for a collection of storage medium types (e.g.
A class for passing options to services.
assertRequiredOptions(array $expectedKeys)
Assert that the list of options provided in this instance exactly match $expectedKeys,...
Service for instantiating BlobStores.
__construct(ILBFactory $lbFactory, ExternalStoreAccess $extStoreAccess, WANObjectCache $cache, ServiceOptions $options)
Service for storing and loading Content objects.
Multi-datacenter aware caching interface.
An interface for generating database load balancers.