1 <?php
2 
3 /**
4  * SimplePie
5  *
6  * A PHP-Based RSS and Atom Feed Framework.
7  * Takes the hard work out of managing a complete RSS/Atom solution.
8  *
9  * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without modification, are
13  * permitted provided that the following conditions are met:
14  *
15  * 	* Redistributions of source code must retain the above copyright notice, this list of
16  * 	  conditions and the following disclaimer.
17  *
18  * 	* Redistributions in binary form must reproduce the above copyright notice, this list
19  * 	  of conditions and the following disclaimer in the documentation and/or other materials
20  * 	  provided with the distribution.
21  *
22  * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
23  * 	  to endorse or promote products derived from this software without specific prior
24  * 	  written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
27  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
28  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
29  * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * @package SimplePie
37  * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
38  * @author Ryan Parman
39  * @author Sam Sneddon
40  * @author Ryan McCue
41  * @link http://simplepie.org/ SimplePie
42  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
43  */
44 
45 namespace SimplePie\Cache;
46 
47 /**
48  * Base for cache objects
49  *
50  * Classes to be used with {@see \SimplePie\Cache::register()} are expected
51  * to implement this interface.
52  *
53  * @package SimplePie
54  * @subpackage Caching
55  * @deprecated since SimplePie 1.8.0, use "Psr\SimpleCache\CacheInterface" instead
56  */
57 interface Base
58 {
59     /**
60      * Feed cache type
61      *
62      * @var string
63      */
64     public const TYPE_FEED = 'spc';
65 
66     /**
67      * Image cache type
68      *
69      * @var string
70      */
71     public const TYPE_IMAGE = 'spi';
72 
73     /**
74      * Create a new cache object
75      *
76      * @param string $location Location string (from SimplePie::$cache_location)
77      * @param string $name Unique ID for the cache
78      * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
79      */
80     public function __construct($location, $name, $type);
81 
82     /**
83      * Save data to the cache
84      *
85      * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
86      * @return bool Successfulness
87      */
88     public function save($data);
89 
90     /**
91      * Retrieve the data saved to the cache
92      *
93      * @return array Data for SimplePie::$data
94      */
95     public function load();
96 
97     /**
98      * Retrieve the last modified time for the cache
99      *
100      * @return int Timestamp
101      */
102     public function mtime();
103 
104     /**
105      * Set the last modified time to the current time
106      *
107      * @return bool Success status
108      */
109     public function touch();
110 
111     /**
112      * Remove the cache
113      *
114      * @return bool Success status
115      */
116     public function unlink();
117 }
118 
119 class_alias('SimplePie\Cache\Base', 'SimplePie_Cache_Base');
120