<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Description of cache_api
 *
 * @author Igor Ratsun
 */
class cache_api
{
    protected  $CI;
    
    public function __construct()
    {
        $this->CI = & get_instance();
        $this->CI->load->driver('cache', $this->CI->config->item('cache_init_config'));
    }

    public function getCache($key)
    {
        return $this->CI->cache->get($key);
    }

    public function saveCache($key, $data)
    {
        if (ENVIRONMENT == 'production') {

            $this->CI->cache->save($key, $data, $this->CI->config->item('cache_life_time'));
        }
    }

}
