<commit_before><?php

namespace Difra;

/**
 * Cache factory
 * Class Cache
 * @package Difra
 */
class Cache
{
    /** Auto detect */
    const INST_AUTO = 'Auto detect';
    /** Memcached module */
    const INST_MEMCACHED = 'MemCached';
    /** Memcache module */
    const INST_MEMCACHE = 'Memcache';
    /** Xcache */
    const INST_XCACHE = 'XCache';
    /** Shared memory */
    const INST_SHAREDMEM = 'Shared Memory';
    /** APCu */
    const INST_APCU = 'APCu';
    /** Stub */
    const INST_NONE = 'None';
    /** Default */
    const INST_DEFAULT = self::INST_AUTO;
    /** Default TTL (seconds) */
    const DEFAULT_TTL = 300;
    /**
     * Configured cache adapters.
     * @var array
     */
    private static $adapters = [];

    /**
     * Builds new cache adapter or returns
     * existing one.
     * @param string $configName
     * @return \Difra\Cache\Common
     */
    public static function getInstance($configName = self::INST_DEFAULT)
    {
        if ($configName == self::INST_AUTO) {
            $configName = self::detect();
        }
        return self::getAdapter($configName);
    }

    /**
     * Detect available adapter
     * @return string
     */
    private static function detect()
    {
        static $autoDetected = null;
        if ($autoDetected) {
            return $autoDetected;
        }
        if (!Debugger::isCachesEnabled()) {
            Debugger::addLine('Caching disabled by Debug Mode settings');
            return self::INST_NONE;
        }
        if (Cache\APCu::isAvailable()) {
            Debugger::addLine('Auto-detected cache type: APCu');
            return $autoDetected = self::INST_APCU;
        } if (Cache\XCache::isAvailable()) {<commit_msg>Fixed multiple messages when caching is disabled by debug mode settings<commit_after><?php

namespace Difra;

/**
 * Cache factory
 * Class Cache
 * @package Difra
 */
class Cache
{
    /** Auto detect */
    const INST_AUTO = 'Auto detect';
    /** Memcached module */
    const INST_MEMCACHED = 'MemCached';
    /** Memcache module */
    const INST_MEMCACHE = 'Memcache';
    /** Xcache */
    const INST_XCACHE = 'XCache';
    /** Shared memory */
    const INST_SHAREDMEM = 'Shared Memory';
    /** APCu */
    const INST_APCU = 'APCu';
    /** Stub */
    const INST_NONE = 'None';
    /** Default */
    const INST_DEFAULT = self::INST_AUTO;
    /** Default TTL (seconds) */
    const DEFAULT_TTL = 300;
    /**
     * Configured cache adapters.
     * @var array
     */
    private static $adapters = [];

    /**
     * Builds new cache adapter or returns
     * existing one.
     * @param string $configName
     * @return \Difra\Cache\Common
     */
    public static function getInstance($configName = self::INST_DEFAULT)
    {
        if ($configName == self::INST_AUTO) {
            $configName = self::detect();
        }
        return self::getAdapter($configName);
    }

    /**
     * Detect available adapter
     * @return string
     */
    private static function detect()
    {
        static $autoDetected = null;
        if ($autoDetected) {
            return $autoDetected;
        }
        if (!Debugger::isCachesEnabled()) {
            Debugger::addLine('Caching disabled by Debug Mode settings');
            return $autoDetected = self::INST_NONE;
        }
        if (Cache\APCu::isAvailable()) {
            Debugger::addLine('Auto-detected cache type: APCu');
            return $autoDetected = self::INST_APCU;
        } if (Cache\XCache::isAvailable()) {
{'fraction_non_alphanumeric': 0.13003975014196478, 'fraction_numerical': 0.0017035775127768314, 'mean_word_length': 2.182475158084914, 'pattern_counts': {'":': 0, '<': 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': '7435132', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1045, 'n_words': 261}