Skip to content

Instantly share code, notes, and snippets.

@dragoonis
Created April 2, 2011 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dragoonis/899783 to your computer and use it in GitHub Desktop.
Save dragoonis/899783 to your computer and use it in GitHub Desktop.
<?php
static function getCache($p_mOptions = null) {
switch(true) {
case is_array($p_mOptions):
return new PPI_Cache($p_mOptions);
break;
case is_null($p_mOptions) || ($bIsString = is_string($p_mOptions)):
$config = self::getConfig();
$options = isset($config->cache) ? $config->cache->toArray() : array();
if(isset($bIsString)) {
$options['handler'] = $p_mOptions;
}
return new PPI_Cache($options);
break;
default:
throw new PPI_Exception('Invalid option passed to getCache()');
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment