I am getting this error on my pages when view them for a 2nd time:
Warning: unserialize() [function.unserialize]: Node no longer exists in /var/www/html/tc/tcgscans.com/wp-content/plugins/wp-file-cache/lib/class.FileCache.php on line 193
And this is the function that is causing the issue:
// Get Amazon Price
function get_amazon_price($asin) {
$transName = "amzn-transient-$asin"; // Name of value in database.
$cacheTime = 24; // Time in hours between updates.
// Do we already have saved data? If not, lets get it.
if ( false === ( $trans = get_transient($transName) ) ) :
// The Function to get Price
$public_key = 'AKIAJ7UYHSJ4L3Q2KINQ';
$private_key = 'nSPy3581vu0ZyV6M5mZ+Hw+AboU43SCY2AED9+Lm';
$pxml = aws_signed_request( 'com', array( 'Operation' => 'ItemLookup', 'ItemId' => $asin, 'ResponseGroup' => 'OfferSummary', 'Availability' => 'Available', 'Condition' => 'All', 'AssociateTag' => 'adamcapr-20', ), $public_key, $private_key );
if ( $pxml === False ) {
$trans = 'n/a';
}
else {
if ( isset( $pxml->Items->Item->OfferSummary->LowestNewPrice->FormattedPrice ) ) {
$trans = $pxml->Items->Item->OfferSummary->LowestNewPrice->FormattedPrice;
}
else {
$trans = 'n/a';
}
}
// Save our new transient, plus save it in the longer "backup" transient.
set_transient($transName, $trans, 60 * 60 * $cacheTime);
endif;
return $trans;
}
And I call it within my templates like this:
if ( get_post_meta($post->ID, 'asin', true) ) {
$asin = get_post_meta($post->ID, 'asin', true);
$out .= '<h4>Price on Amazon: ';
if ( function_exists('get_amazon_price') ) $out .= get_amazon_price($asin);
$out .= '</h4>';
}
Basically I save a transient value, and call it within my template. On the first page load it shows up ok, but on subsequent views the error shows.
Any idea how to fix the issue? Thanks!