Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Stash {
- private $_pool;
- public function __construct($options)
- {
- include_once APPPATH . '/third_party/Stash/autoload.php';
- if (isset($options['stash']) && isset($options['stash']['path'])) {
- if (substr($options['stash']['path'], 0, 1) != '/') {
- $options['stash']['path'] = getcwd() . '/' . $options['stash']['path'];
- }
- }
- $handler = new StashHandlerFileSystem(@$options['stash']);
- $this->_pool = new StashPool;
- $this->_pool->setHandler($handler);
- }
- public function getCache($path)
- {
- return $this->_pool->getCache($path);
- }
- }
- ?>
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- /*
- | -------------------------------------------------------------------
- | Stash Cache settings
- | -------------------------------------------------------------------
- |
- */
- $config['stash'] = array('path' => APPPATH .'/cache');
- $this->load->library('Stash');
- $cache = $this->stash->getCache(array('key1','subkey1','subkey2'));
- $cache->set('foo', 'bar', 30);
Add Comment
Please, Sign In to add comment