<commit_before><?php
/**
 * Apc Cache Handler
 *
 * @package   Molajo
 * @license   http://www.opensource.org/licenses/mit-license.html MIT License
 * @copyright 2013 <NAME>. All rights reserved.
 */
namespace Molajo\Cache\Handler;

use Exception;
use Molajo\Cache\CacheItem;
use Molajo\Cache\Api\CacheInterface;
use Molajo\Cache\Exception\ApcHandlerException;

/**
 * Apc Cache Handler
 *
 * @author    <NAME>
 * @license   http://www.opensource.org/licenses/mit-license.html MIT License
 * @copyright 2013 <NAME>. All rights reserved.
 * @since     1.0
 */
class Apc extends AbstractHandler implements CacheInterface
{
    /**
     * Constructor
     *
     * @param   string $cache_handler
     *
     * @since   1.0
     */
    public function __construct($cache_handler = 'Apc')
    {
        parent::__construct($cache_handler);
    }

    /**
     * Connect to Cache
     *
     * @param   array $options
     *
     * @return  $this
     * @since   1.0
     * @throws  ApcHandlerException
     */
    public function connect($options = array())
    {
        if (extension_loaded('apc')
            && ini_get('apc.enabled')) {
        } else {
            ini_set('apc.enabled', 1);
        }

        if (extension_loaded('apc')
            && ini_get('apc.enabled')) {
        } else {
            ini_set('display_errors', 1);
            throw new ApcHandlerException ('Cache APC: APC is not enabled');
        }

        return parent::connect($options);
    }

    /**
     * Return cached value
     *
     * @param   string $key
     *
     * @return  bool|CacheItem
     * @since   1.0
     * @throws  ApcHandlerException
     */
    public function get($key)
    {
        if ($this->cache_service == 0) {
            return false;
        }<commit_msg>Add test to see if APC is enabled and loaded"<commit_after><?php
/**
 * Apc Cache Handler
 *
 * @package   Molajo
 * @license   http://www.opensource.org/licenses/mit-license.html MIT License
 * @copyright 2013 <NAME>. All rights reserved.
 */
namespace Molajo\Cache\Handler;

use Exception;
use Molajo\Cache\CacheItem;
use Molajo\Cache\Api\CacheInterface;
use Molajo\Cache\Exception\ApcHandlerException;

/**
 * Apc Cache Handler
 *
 * @author    <NAME>
 * @license   http://www.opensource.org/licenses/mit-license.html MIT License
 * @copyright 2013 <NAME>. All rights reserved.
 * @since     1.0
 */
class Apc extends AbstractHandler implements CacheInterface
{
    /**
     * Constructor
     *
     * @param   string $cache_handler
     *
     * @since   1.0
     */
    public function __construct($cache_handler = 'Apc')
    {
        parent::__construct($cache_handler);
    }

    /**
     * Connect to Cache
     *
     * @param   array $options
     *
     * @return  $this
     * @since   1.0
     * @throws  ApcHandlerException
     */
    public function connect($options = array())
    {
        if (extension_loaded('apc')
            && ini_get('apc.enabled')) {
        } else {
            throw new ApcHandlerException ('Cache APC: APC is not enabled');
        }

        return parent::connect($options);
    }

    /**
     * Return cached value
     *
     * @param   string $key
     *
     * @return  bool|CacheItem
     * @since   1.0
     * @throws  ApcHandlerException
     */
    public function get($key)
    {
        if ($this->cache_service == 0) {
            return false;
        }
{'fraction_non_alphanumeric': 0.12418879056047198, 'fraction_numerical': 0.010619469026548672, 'mean_word_length': 2.093978102189781, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6367352', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1018, 'n_words': 239}