Completed
Push — master ( 32dcda...951284 )
by
unknown
06:45 queued 10s
created

TermFallbackCacheServiceFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A newSharedCache() 0 3 1
A newInMemoryCache() 0 3 1
A newCache() 0 3 1
A newStatsdRecordingCache() 0 7 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Wikibase\Lib\TermFallbackCache;
6
7
use BagOStuff;
8
use CachedBagOStuff;
9
use IBufferingStatsdDataFactory;
10
use ObjectCache;
11
use Psr\SimpleCache\CacheInterface;
12
use Wikibase\Lib\SimpleCacheWithBagOStuff;
13
use Wikibase\Lib\StatsdRecordingSimpleCache;
14
15
/**
16
 * @license GPL-2.0-or-later
17
 */
18
class TermFallbackCacheServiceFactory {
19
20
	public function newSharedCache( $termFallbackCacheType ): BagOStuff {
21
		return ObjectCache::getInstance( $termFallbackCacheType );
22
	}
23
24
	public function newInMemoryCache( BagOStuff $bagOStuff ): CachedBagOStuff {
25
		return new CachedBagOStuff( $bagOStuff );
26
	}
27
28
	public function newCache( BagOStuff $bagOStuff, string $prefix, string $secret ): SimpleCacheWithBagOStuff {
29
		return new SimpleCacheWithBagOStuff( $bagOStuff, $prefix, $secret );
30
	}
31
32
	public function newStatsdRecordingCache(
33
		CacheInterface $inner,
34
		IBufferingStatsdDataFactory $statsdDataFactory,
35
		array $statsKeys
36
	): StatsdRecordingSimpleCache {
37
		return new StatsdRecordingSimpleCache( $inner, $statsdDataFactory, $statsKeys );
38
	}
39
}
40