Changeset 59141 for trunk/src/wp-includes/class-wp-feed-cache-transient.php
- Timestamp:
- 09/30/2024 10:48:16 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-feed-cache-transient.php
r54133 r59141 12 12 * 13 13 * @since 2.8.0 14 * @since 6.7.0 Now properly implements the SimplePie\Cache\Base interface. 14 15 */ 15 16 #[AllowDynamicProperties] 16 class WP_Feed_Cache_Transient {17 class WP_Feed_Cache_Transient implements SimplePie\Cache\Base { 17 18 18 19 /** … … 43 44 44 45 /** 45 * C onstructor.46 * Creates a new (transient) cache object. 46 47 * 47 48 * @since 2.8.0 48 49 * @since 3.2.0 Updated to use a PHP5 constructor. 50 * @since 6.7.0 Parameter names have been updated to be in line with the `SimplePie\Cache\Base` interface. 49 51 * 50 * @param string $location URL location (scheme is used to determine handler). 51 * @param string $filename Unique identifier for cache object. 52 * @param string $extension 'spi' or 'spc'. 52 * @param string $location URL location (scheme is used to determine handler). 53 * @param string $name Unique identifier for cache object. 54 * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type Either `TYPE_FEED` ('spc') for SimplePie data, 55 * or `TYPE_IMAGE` ('spi') for image data. 53 56 */ 54 public function __construct( $location, $ filename, $extension) {55 $this->name = 'feed_' . $ filename;56 $this->mod_name = 'feed_mod_' . $ filename;57 public function __construct( $location, $name, $type ) { 58 $this->name = 'feed_' . $name; 59 $this->mod_name = 'feed_mod_' . $name; 57 60 58 61 $lifetime = $this->lifetime; … … 63 66 * 64 67 * @param int $lifetime Cache duration in seconds. Default is 43200 seconds (12 hours). 65 * @param string $ filenameUnique identifier for the cache object.68 * @param string $name Unique identifier for the cache object. 66 69 */ 67 $this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $ filename );70 $this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $name ); 68 71 } 69 72 70 73 /** 71 * S etsthe transient.74 * Saves data to the transient. 72 75 * 73 76 * @since 2.8.0 74 77 * 75 * @param SimplePie $data Data to save. 78 * @param array|SimplePie\SimplePie $data Data to save. If passed a SimplePie object, 79 * only cache the `$data` property. 76 80 * @return true Always true. 77 81 */ 78 82 public function save( $data ) { 79 if ( $data instanceof SimplePie ) {83 if ( $data instanceof SimplePie\SimplePie ) { 80 84 $data = $data->data; 81 85 } … … 87 91 88 92 /** 89 * Getsthe transient.93 * Retrieves the data saved in the transient. 90 94 * 91 95 * @since 2.8.0 92 96 * 93 * @return mixed Transient value.97 * @return array Data for `SimplePie::$data`. 94 98 */ 95 99 public function load() { … … 102 106 * @since 2.8.0 103 107 * 104 * @return mixed Transient value.108 * @return int Timestamp. 105 109 */ 106 110 public function mtime() {
Note: See TracChangeset
for help on using the changeset viewer.