Working on the caching

Not sure how I got back on the master branch, meh.
This commit is contained in:
Josh Sherman 2013-02-28 12:24:02 -05:00
parent 684ff2fef1
commit 6a1cf8c035
2 changed files with 47 additions and 10 deletions

View file

@ -35,6 +35,9 @@
*/
class Cache extends Object
{
private $handler = null;
private $datasource = null;
/**
* Hostname for the Memcached Server
*
@ -93,22 +96,33 @@ class Cache extends Object
{
$datasource = $this->config->datasources[$this->config->pickles['cache']];
var_dump($datasource);
exit;
if (!isset($datasource['type']))
{
throw new Exception('You must specify the datasource\'s type');
}
foreach (array('hostname', 'port', 'database', 'namespace') as $variable)
switch ($datasource['type'])
{
if (isset($datasource[$variable]))
{
$this->$variable = $datasource[$variable];
}
}
}
case 'memcache':
case 'memcached':
$this->handler = 'memcached';
break;
case 'redis':
$this->handler = 'redis';
break;
default:
throw new Exception('The specified datasource type "' . $datasource['type'] . '" is unsupported.');
}
if ($this->namespace != '')
{
$this->namespace .= ':';
}
$this->datasource = $datasource;
}
}
}

23
jar.php
View file

@ -614,6 +614,9 @@ class Browser extends Object
*/
class Cache extends Object
{
private $handler = null;
private $datasource = null;
/**
* Hostname for the Memcached Server
*
@ -672,6 +675,26 @@ class Cache extends Object
{
$datasource = $this->config->datasources[$this->config->pickles['cache']];
if (!isset($datasource['type']))
{
throw new Exception('You must specify the datasource\'s type');
}
switch ($datasource['type'])
{
case 'memcache':
case 'memcached':
$this->handler = 'memcached';
break;
case 'redis':
$this->handler = 'redis';
break;
default:
throw new Exception('The specified datasource type "' . $datasource['type'] . '" is unsupported.');
}
var_dump($datasource);
exit;