unset($event->eventDate); unset($event->listingCount); // Save the venue if not set if (!isset($output->venues[$venue->venueId])) { $output->venues[$venue->venueId] = $venue; } // Add the event to the venue key if (!isset($output->events[$venue->venueId])) { $output->events[$venue->venueId] = array(); } $output->events[$venue->venueId][] = $event; } } // Encode the data to a json string $encodedOutput = json_encode($output); // Update the cache file $cacheUtil->write($encodedOutput); // Release the obtained lock $cacheUtil->unlock(); // Finally dump the updated cache expiresHeader(); echo $encodedOutput; } ?>