MediaWiki master
BlobStoreFactory.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Storage;
8
14
23
27 public const CONSTRUCTOR_OPTIONS = [
32 ];
33
34 public function __construct(
35 private readonly ILBFactory $lbFactory,
36 private readonly ExternalStoreAccess $extStoreAccess,
37 private readonly WANObjectCache $cache,
38 private readonly ServiceOptions $options,
39 ) {
40 $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
41 }
42
50 public function newBlobStore( $dbDomain = false ) {
51 return $this->newSqlBlobStore( $dbDomain );
52 }
53
61 public function newSqlBlobStore( $dbDomain = false ) {
62 $lb = $this->lbFactory->getMainLB( $dbDomain );
63 $store = new SqlBlobStore(
64 $lb,
65 $this->extStoreAccess,
66 $this->cache,
67 $dbDomain
68 );
69
70 $store->setCompressBlobs( $this->options->get( MainConfigNames::CompressRevisions ) );
71 $store->setCacheExpiry( $this->options->get( MainConfigNames::RevisionCacheExpiry ) );
72 $store->setUseExternalStore(
73 $this->options->get( MainConfigNames::DefaultExternalStore ) !== false );
74
75 if ( $this->options->get( MainConfigNames::LegacyEncoding ) ) {
76 $store->setLegacyEncoding( $this->options->get( MainConfigNames::LegacyEncoding ) );
77 }
78
79 return $store;
80 }
81
82}
A class for passing options to services.
This is the main interface for fetching or inserting objects with ExternalStore.
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(private readonly ILBFactory $lbFactory, private readonly ExternalStoreAccess $extStoreAccess, private readonly WANObjectCache $cache, private readonly 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.