MediaWiki REL1_37
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
60 public const CONSTRUCTOR_OPTIONS = [
61 'CompressRevisions',
62 'DefaultExternalStore',
63 'LegacyEncoding',
64 'RevisionCacheExpiry',
65 ];
66
67 public function __construct(
72 ) {
73 $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
74
75 $this->lbFactory = $lbFactory;
76 $this->extStoreAccess = $extStoreAccess;
77 $this->cache = $cache;
78 $this->options = $options;
79 }
80
88 public function newBlobStore( $dbDomain = false ) {
89 return $this->newSqlBlobStore( $dbDomain );
90 }
91
99 public function newSqlBlobStore( $dbDomain = false ) {
100 $lb = $this->lbFactory->getMainLB( $dbDomain );
101 $store = new SqlBlobStore(
102 $lb,
103 $this->extStoreAccess,
104 $this->cache,
105 $dbDomain
106 );
107
108 $store->setCompressBlobs( $this->options->get( 'CompressRevisions' ) );
109 $store->setCacheExpiry( $this->options->get( 'RevisionCacheExpiry' ) );
110 $store->setUseExternalStore( $this->options->get( 'DefaultExternalStore' ) !== false );
111
112 if ( $this->options->get( 'LegacyEncoding' ) ) {
113 $store->setLegacyEncoding( $this->options->get( 'LegacyEncoding' ) );
114 }
115
116 return $store;
117 }
118
119}
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.