Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
   1  <?php
   2  
   3  declare(strict_types=1);
   4  
   5  namespace OpenSpout\Reader\XLSX\Manager\SharedStringsCaching;
   6  
   7  /**
   8   * @internal
   9   */
  10  interface CachingStrategyInterface
  11  {
  12      /**
  13       * Adds the given string to the cache.
  14       *
  15       * @param string $sharedString      The string to be added to the cache
  16       * @param int    $sharedStringIndex Index of the shared string in the sharedStrings.xml file
  17       */
  18      public function addStringForIndex(string $sharedString, int $sharedStringIndex): void;
  19  
  20      /**
  21       * Closes the cache after the last shared string was added.
  22       * This prevents any additional string from being added to the cache.
  23       */
  24      public function closeCache(): void;
  25  
  26      /**
  27       * Returns the string located at the given index from the cache.
  28       *
  29       * @param int $sharedStringIndex Index of the shared string in the sharedStrings.xml file
  30       *
  31       * @return string The shared string at the given index
  32       *
  33       * @throws \OpenSpout\Reader\Exception\SharedStringNotFoundException If no shared string found for the given index
  34       */
  35      public function getStringAtIndex(int $sharedStringIndex): string;
  36  
  37      /**
  38       * Destroys the cache, freeing memory and removing any created artifacts.
  39       */
  40      public function clearCache(): void;
  41  }