Total Complexity | 3 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
11 | class CacheKeyProvider { |
||
12 | |||
13 | /** |
||
14 | * Update the version to force a recache for all items due to |
||
15 | * required changes |
||
16 | */ |
||
17 | const VERSION = '1.2'; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $cachePrefix = ''; |
||
23 | |||
24 | /** |
||
25 | * @since 1.0 |
||
26 | * |
||
27 | * @param string $cachePrefix |
||
28 | */ |
||
29 | 15 | public function setCachePrefix( $cachePrefix ) { |
|
30 | 15 | $this->cachePrefix = $cachePrefix; |
|
31 | 15 | } |
|
32 | |||
33 | /** |
||
34 | * @since 1.0 |
||
35 | * |
||
36 | * @param string $hash |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | 15 | public function getCacheKeyForCitationReference( $hash ) { |
|
41 | 15 | return $this->cachePrefix . ':sci:ref:' . md5( $hash . self::VERSION ); |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * @since 1.0 |
||
46 | * |
||
47 | * @param string $hash |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | 15 | public function getCacheKeyForReferenceList( $hash ) { |
|
53 | } |
||
54 | |||
55 | } |
||
56 |