Working on the caching
Not sure how I got back on the master branch, meh.
This commit is contained in:
parent
684ff2fef1
commit
6a1cf8c035
2 changed files with 47 additions and 10 deletions
|
@ -35,6 +35,9 @@
|
||||||
*/
|
*/
|
||||||
class Cache extends Object
|
class Cache extends Object
|
||||||
{
|
{
|
||||||
|
private $handler = null;
|
||||||
|
private $datasource = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hostname for the Memcached Server
|
* Hostname for the Memcached Server
|
||||||
*
|
*
|
||||||
|
@ -93,22 +96,33 @@ class Cache extends Object
|
||||||
{
|
{
|
||||||
$datasource = $this->config->datasources[$this->config->pickles['cache']];
|
$datasource = $this->config->datasources[$this->config->pickles['cache']];
|
||||||
|
|
||||||
var_dump($datasource);
|
if (!isset($datasource['type']))
|
||||||
exit;
|
|
||||||
|
|
||||||
foreach (array('hostname', 'port', 'database', 'namespace') as $variable)
|
|
||||||
{
|
{
|
||||||
if (isset($datasource[$variable]))
|
throw new Exception('You must specify the datasource\'s type');
|
||||||
{
|
}
|
||||||
$this->$variable = $datasource[$variable];
|
|
||||||
}
|
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.');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->namespace != '')
|
if ($this->namespace != '')
|
||||||
{
|
{
|
||||||
$this->namespace .= ':';
|
$this->namespace .= ':';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->datasource = $datasource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
23
jar.php
23
jar.php
|
@ -614,6 +614,9 @@ class Browser extends Object
|
||||||
*/
|
*/
|
||||||
class Cache extends Object
|
class Cache extends Object
|
||||||
{
|
{
|
||||||
|
private $handler = null;
|
||||||
|
private $datasource = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hostname for the Memcached Server
|
* Hostname for the Memcached Server
|
||||||
*
|
*
|
||||||
|
@ -672,6 +675,26 @@ class Cache extends Object
|
||||||
{
|
{
|
||||||
$datasource = $this->config->datasources[$this->config->pickles['cache']];
|
$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);
|
var_dump($datasource);
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue