SimplePie 1.3.1 is now available. Upgrade now!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » API Reference » SimplePie » set_cache_location()

set_cache_location()

Description

class SimplePie {
	set_cache_location ( [string $location = './cache'] )
}

Set the file system location (not WWW location) where the cache files should be written.

Availability

  • Available since SimplePie 1.0.
  • Previously existed as cache_location() since SimplePie Preview Release.

Parameters

location

Set where the cache files should be stored.

Examples

Change the cache location to http://domain.com/app/cache_files/

$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');
$feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/app/cache_files');
$feed->init();
$feed->handle_content_type();
echo $feed->get_title();

Set a database location

:!: Unsupported! We've enabled MySQL caching in an experimental branch that will be integrated into a future SimplePie release. If you're using that experimental branch, you can enable database caching as follows:

$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');
$feed->set_cache_location('mysql://username:password@hostname:port/database');
$feed->init();
$feed->handle_content_type();
echo $feed->get_title();

See Also


reference/simplepie/set_cache_location.txt · Last modified: 2011/03/05 19:56 (external edit)