1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
declare(strict_types=1);
|
|
|
4 |
|
|
|
5 |
namespace OpenSpout\Reader\XLSX\Manager\SharedStringsCaching;
|
|
|
6 |
|
|
|
7 |
use OpenSpout\Reader\Exception\SharedStringNotFoundException;
|
|
|
8 |
|
|
|
9 |
/**
|
|
|
10 |
* @internal
|
|
|
11 |
*/
|
|
|
12 |
interface CachingStrategyInterface
|
|
|
13 |
{
|
|
|
14 |
/**
|
|
|
15 |
* Adds the given string to the cache.
|
|
|
16 |
*
|
|
|
17 |
* @param string $sharedString The string to be added to the cache
|
|
|
18 |
* @param int $sharedStringIndex Index of the shared string in the sharedStrings.xml file
|
|
|
19 |
*/
|
|
|
20 |
public function addStringForIndex(string $sharedString, int $sharedStringIndex): void;
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Closes the cache after the last shared string was added.
|
|
|
24 |
* This prevents any additional string from being added to the cache.
|
|
|
25 |
*/
|
|
|
26 |
public function closeCache(): void;
|
|
|
27 |
|
|
|
28 |
/**
|
|
|
29 |
* Returns the string located at the given index from the cache.
|
|
|
30 |
*
|
|
|
31 |
* @param int $sharedStringIndex Index of the shared string in the sharedStrings.xml file
|
|
|
32 |
*
|
|
|
33 |
* @return string The shared string at the given index
|
|
|
34 |
*
|
|
|
35 |
* @throws SharedStringNotFoundException If no shared string found for the given index
|
|
|
36 |
*/
|
|
|
37 |
public function getStringAtIndex(int $sharedStringIndex): string;
|
|
|
38 |
|
|
|
39 |
/**
|
|
|
40 |
* Destroys the cache, freeing memory and removing any created artifacts.
|
|
|
41 |
*/
|
|
|
42 |
public function clearCache(): void;
|
|
|
43 |
}
|