Skip to content

Commit

Permalink
Add driver for PEAR2_Cache_Lite, use this as the default driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
saltybeagle committed May 11, 2011
1 parent 3984054 commit b602c50
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/PEAR2/Templates/Savant/Turbo/CacheInterface/CacheLite.php
@@ -0,0 +1,49 @@
<?php

namespace PEAR2\Templates\Savant\Turbo\CacheInterface;

use PEAR2\Templates\Savant\Turbo\CacheInterface;
use PEAR2\Templates\Savant\Turbo;

class CacheLite implements CacheInterface
{
/**
* Cache_Lite object
*
* @var Cache_Lite
*/
protected $cache;

public $options = array('lifeTime'=>3600);

public $group;

/**
* Constructor
*/
function __construct($options = array())
{
$this->options = $options + $this->options;
$this->cache = new \PEAR2\Cache\Lite\Main($this->options);
}

/**
* Get an item stored in the cache
*
* @see CacheInterface#get()
*/
function get($key)
{
return $this->cache->get($key, $this->group);
}

/**
* Save an element to the cache
*
* @see CacheInterface#save()
*/
function save($data, $key)
{
return $this->cache->save($data, $key, $this->group);
}
}

0 comments on commit b602c50

Please sign in to comment.