MediaWiki REL1_40
BlobStoreFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Storage;
22
28
37
41 private $lbFactory;
42
46 private $extStoreAccess;
47
51 private $cache;
52
56 private $options;
57
61 public const CONSTRUCTOR_OPTIONS = [
66 ];
67
68 public function __construct(
69 ILBFactory $lbFactory,
70 ExternalStoreAccess $extStoreAccess,
71 WANObjectCache $cache,
72 ServiceOptions $options
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( MainConfigNames::CompressRevisions ) );
110 $store->setCacheExpiry( $this->options->get( MainConfigNames::RevisionCacheExpiry ) );
111 $store->setUseExternalStore(
112 $this->options->get( MainConfigNames::DefaultExternalStore ) !== false );
113
114 if ( $this->options->get( MainConfigNames::LegacyEncoding ) ) {
115 $store->setLegacyEncoding( $this->options->get( MainConfigNames::LegacyEncoding ) );
116 }
117
118 return $store;
119 }
120
121}
This is the main interface for fetching or inserting objects with ExternalStore.
A class for passing options to services.
assertRequiredOptions(array $expectedKeys)
Assert that the list of options provided in this instance exactly match $expectedKeys,...
A class containing constants representing the names of configuration variables.
const RevisionCacheExpiry
Name constant for the RevisionCacheExpiry setting, for use with Config::get()
const LegacyEncoding
Name constant for the LegacyEncoding setting, for use with Config::get()
const DefaultExternalStore
Name constant for the DefaultExternalStore setting, for use with Config::get()
const CompressRevisions
Name constant for the CompressRevisions setting, for use with Config::get()
Service for instantiating BlobStores.
__construct(ILBFactory $lbFactory, ExternalStoreAccess $extStoreAccess, WANObjectCache $cache, ServiceOptions $options)
Service for storing and loading Content objects representing revision data blobs.
Multi-datacenter aware caching interface.
Manager of ILoadBalancer objects and, indirectly, IDatabase connections.