Skip to content

Instantly share code, notes, and snippets.

@avdg
Forked from dragoonis/gist:899783
Created April 2, 2011 19:30
Show Gist options
  • Save avdg/899797 to your computer and use it in GitHub Desktop.
Save avdg/899797 to your computer and use it in GitHub Desktop.
<?php
static function getCache($p_mOptions = null) {
switch(true) {
case is_array($p_mOptions):
$options = $p_mOptions;
break;
case is_string($p_mOptions):
$config = self::getConfig();
$options = isset($config->cache) ? $config->cache->toArray() : array();
$options['handler'] = $p_mOptions;
break;
case is_null($p_mOptions):
$config = self::getConfig();
$options = isset($config->cache) ? $config->cache->toArray() : array();
break;
default:
return;
}
return new PPI_Cache($options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment