WordPress.org

Make WordPress Core

Changeset 11446


Ignore:
Timestamp:
05/24/2009 06:07:39 PM (9 years ago)
Author:
westi
Message:

Allow plugins to filter the expiration time of the SimplePie cache. Fixes #9926.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-feed.php

    r10929 r11446  
    2626
    2727class WP_Feed_Cache_Transient {
    28     var $location;
    29     var $filename;
    30     var $extension;
    3128    var $name;
     29    var $mod_name;
     30    var $lifetime = 43200; //Default lifetime in cache of 12 hours
    3231
    3332    function WP_Feed_Cache_Transient($location, $filename, $extension) {
    34         //$this->location = $location;
    35         //$this->filename = rawurlencode($filename);
    36         //$this->extension = rawurlencode($extension);
    37         //$this->name = "$location/$this->filename.$this->extension";
    3833        $this->name = 'feed_' . $filename;
    3934        $this->mod_name = 'feed_mod_' . $filename;
     35        $this->lifetime = apply_filters('wp_feed_cache_transient_lifetime', $this->lifetime, $filename);
    4036    }
    4137
     
    4440            $data = $data->data;
    4541
    46         set_transient($this->name, $data, 43200);
    47         set_transient($this->mod_name, time(), 43200);
     42        set_transient($this->name, $data, $this->lifetime);
     43        set_transient($this->mod_name, time(), $this->lifetime);
    4844        return true;
    4945    }
     
    5854
    5955    function touch() {
    60         return set_transient($this->mod_name, time(), 43200);
     56        return set_transient($this->mod_name, time(), $this->lifetime);
    6157    }
    6258
Note: See TracChangeset for help on using the changeset viewer.