[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/SimplePie/src/Cache/ -> Base.php (source)

   1  <?php
   2  
   3  // SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
   4  // SPDX-License-Identifier: BSD-3-Clause
   5  
   6  declare(strict_types=1);
   7  
   8  namespace SimplePie\Cache;
   9  
  10  /**
  11   * Base for cache objects
  12   *
  13   * Classes to be used with {@see \SimplePie\Cache::register()} are expected
  14   * to implement this interface.
  15   *
  16   * @deprecated since SimplePie 1.8.0, use "Psr\SimpleCache\CacheInterface" instead
  17   */
  18  interface Base
  19  {
  20      /**
  21       * Feed cache type
  22       *
  23       * @var string
  24       */
  25      public const TYPE_FEED = 'spc';
  26  
  27      /**
  28       * Image cache type
  29       *
  30       * @var string
  31       */
  32      public const TYPE_IMAGE = 'spi';
  33  
  34      /**
  35       * Create a new cache object
  36       *
  37       * @param string $location Location string (from SimplePie::$cache_location)
  38       * @param string $name Unique ID for the cache
  39       * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
  40       */
  41      public function __construct(string $location, string $name, $type);
  42  
  43      /**
  44       * Save data to the cache
  45       *
  46       * @param array<mixed>|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
  47       * @return bool Successfulness
  48       */
  49      public function save($data);
  50  
  51      /**
  52       * Retrieve the data saved to the cache
  53       *
  54       * @return array<mixed> Data for SimplePie::$data
  55       */
  56      public function load();
  57  
  58      /**
  59       * Retrieve the last modified time for the cache
  60       *
  61       * @return int Timestamp
  62       */
  63      public function mtime();
  64  
  65      /**
  66       * Set the last modified time to the current time
  67       *
  68       * @return bool Success status
  69       */
  70      public function touch();
  71  
  72      /**
  73       * Remove the cache
  74       *
  75       * @return bool Success status
  76       */
  77      public function unlink();
  78  }
  79  
  80  class_alias('SimplePie\Cache\Base', 'SimplePie_Cache_Base');


Generated : Fri Oct 10 08:20:03 2025 Cross-referenced by PHPXref