示例#1
0
	, "https://webservices.secure-tix.com/rest/v2/getJsonEvents?userId=300&venueId=8513"
	];

// Cache location
$cacheFile = "cache/events.cache";

// Instantiate the caching utility
$cacheUtil = new CacheUtil($cacheFile);

if ($cacheUtil->exists() && !$cacheUtil->isExpired()) {
	// Cache exists and has not expired, dump the cache
	expiresHeader();
	$cacheUtil->read();
} else {
	// Obtain a lock to perform the update
	$cacheUtil->lock();

	// Recheck cache
	if ($cacheUtil->exists() && !$cacheUtil->isExpired()) {
		// Cache was updated while waiting for a lock, dump and die
		$cacheUtil->read();
		die();
	}

	// Combine both data sources
	$output = new stdClass;
	$output->venues = array();
	$output->events = array();

	// Read each address, strip useless data, and combine events on a key of 'venueId'
	foreach ($addresses as $address) {