Skip to content

Instantly share code, notes, and snippets.

@dragoonis
Forked from avdg/gist:899811
Created April 2, 2011 19:51
Show Gist options
  • Select an option

  • Save dragoonis/899817 to your computer and use it in GitHub Desktop.

Select an option

Save dragoonis/899817 to your computer and use it in GitHub Desktop.
<?php
/**
* Get the cache object
*
* @param null|string|array $p_mOptions The information to get a different cache object
* @return PPI_Cache
*/
static function getCache($p_mOptions = null) {
if(is_array($p_mOptions)) {
return new PPI_Cache($p_mOptions);
}
$options = array();
// Lets use the defaults from the config file as no special parameters were needed.
if($p_mOptions === null || ($bIsString = is_string($p_mOptions))) {
$config = self::getConfig();
$options = !empty($config->cache->handler) ? $config->cache->toArray() : array();
if(isset($bIsString) && $bIsString === true) {
$options['handler'] = $p_mOptions;
}
}
return new PPI_Cache($options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment