I have the following code that caches the xml output. The problem is after it caches the xml object into memcache and then I access the xml object in memcache I get the error:
“Warning: Memcache::get() [memcache.get]: Node no longer exists in …”
$cachekey = md5($url);
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$data = $memcache->get($cachekey);
if($data === FALSE)
{
$data = simplexml_load_file($url);
$memcache->set($cachekey,$data,FALSE,900) or die ("Failed to create cache set");
}
How can I fix this? Thanks!
Ok I got it to work, instead of loading the xml file from the url I downloaded it into a string, then loaded the xml from string: