Friday, March 25, 2011

A little PHP caching goes a long way

Below is a simple example of php caching. It can dramatically reduce the load on the server by bypassing mysql, or other database pulls, for relatively static content.

< ?php

$cachefile = 'cache/cachedData.xml';
$cachetime = 1 * 60 * 60;
// Serve from the cache if it is younger than $cachetime
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
header('Content-type: application/atom+xml; charset=UTF-8');
include($cachefile);
// echo "\n";
exit;
}
ob_start(); // Start the output buffer

// create content here
// if the page is not already cached and loaded from above it will be created here and delivered
// The content will then be cached below for faster future accessing
// this works well for information that changes slowly or not at all.

// Cache the output to a file
$fp = fopen($cachefile, 'w');
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush(); // Send the output to the browser

?>

Thursday, March 17, 2011

Apps Banned

Today I was reviewing the Splaysoft apps in various countries and I realized that for some reason all our Social Networking apps are gone from the Saudi Arabian iTunes Store. I noticed something was wrong with downloads of mySaudiArabia a couple weeks ago, but only today made the connection. I've put an inquiry into Apple support to find out if this is a glitch or an intentional censorship by the Saudi government. I'll post more when I hear back from Apple.

The apps, including mySaudiArabia, have been in the SA store for over a year. I did not receive any emails or calls from Apple letting me know that the apps were removed. I'm not sure if they notify developers over issues like this or not. The apps are clearly marked to make them available in iTC.

I'm disappointed since I had a good number of downloads coming from Saudi Arabia.

For some reason Heads Tails is missing in The Brazilian store! That doesn't make any sense, its just a coin flipping app.