<commit_before><?php
/**
 * APCu Cache Driver
 *
 * "predis/predis": "^1.1"
 */
#################################################################################################################################

namespace Nofuzz\SimpleCache\Drivers;

class Apcu implements \Nofuzz\SimpleCache\CacheInterface
{
  /**
   * Constructor
   */
  public function __construct(array $options=null)
  {
    # Check if APCu extension is loaded and available
    if ( ( extension_loaded('apcu') == false ) ||
         ( ini_get('apc.enabled') != '1' ) )
    {
      // APCu is NOT enabled/loaded
      throw new \Psr\SimpleCache\CacheException('APCu extension not available');
    }

  }

  /**
   * Get $key from cache
   *
   * @param  [type] $key     [description]
   * @param  [type] $default [description]
   * @return mixed
   */
  public function get($key, $default = null)
  {
    $success = false;
    $value = apcu_fetch( $key, $success );

    return ( $success ? $value : $default );
  }

  /**
   * Set the $key to $value, with $ttl (default 0)<commit_msg>Fix for SimpleCache/CacheException namespace path<commit_after><?php
/**
 * APCu Cache Driver
 *
 * "predis/predis": "^1.1"
 */
#################################################################################################################################

namespace Nofuzz\SimpleCache\Drivers;

class Apcu implements \Nofuzz\SimpleCache\CacheInterface
{
  /**
   * Constructor
   */
  public function __construct(array $options=null)
  {
    # Check if APCu extension is loaded and available
    if ( ( extension_loaded('apcu') == false ) ||
         ( ini_get('apc.enabled') != '1' ) )
    {
      // APCu is NOT enabled/loaded
      throw new \Nofuzz\SimpleCache\CacheException('APCu extension not available');
    }

  }

  /**
   * Get $key from cache
   *
   * @param  [type] $key     [description]
   * @param  [type] $default [description]
   * @return mixed
   */
  public function get($key, $default = null)
  {
    $success = false;
    $value = apcu_fetch( $key, $success );

    return ( $success ? $value : $default );
  }

  /**
   * Set the $key to $value, with $ttl (default 0)
{'fraction_non_alphanumeric': 0.24849047840222946, 'fraction_numerical': 0.0037157454714352067, 'mean_word_length': 3.223529411764706, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1861409', 'n_tokens_mistral': 670, 'n_tokens_neox': 641, 'n_words': 159}