Supplying cache age for individual RSS feed

2004-12-02
2013-04-30
  • Scott Wallace
    Scott Wallace
    2004-12-02

    Patch to specify a seperate cache age for an individual feed.  Thanks to Robin Millette (http://rym.waglo.com/).

    --- snip! ---
    $ diff -uw rss_fetch.inc.orig rss_fetch.inc
    --- rss_fetch.inc.orig  2004-12-02 11:28:29.000000000 +0000
    +++ rss_fetch.inc       2004-12-02 11:33:41.000000000 +0000
    @@ -85,7 +85,7 @@

    $MAGPIE_ERROR = "";

    -function fetch_rss ($url) {
    +function fetch_rss ($url, $cache_age = null) {
            // initialize constants
            init();

    @@ -114,7 +114,9 @@
                    // 3. if cached obj fails freshness check, fetch remote
                    // 4. if remote fails, return stale object, or error

    -               $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
    +               if (!isset($cache_age)) $cache_age=MAGPIE_CACHE_AGE;
    +
    +               $cache = new RSSCache( MAGPIE_CACHE_DIR, $cache_age );

                    if (MAGPIE_DEBUG and $cache->ERROR) {
                            debug($cache->ERROR, E_USER_WARNING);
    --- snip! ---