<commit_before><?php
/**
 * Cache using the filesystem
 * 
 * @category 	Erdiko
 * @package  	core
 * @copyright 	Copyright (c) 2014, Arroyo Labs, www.arroyolabs.com
 * @author		<NAME>
 * @author		<NAME>, <EMAIL>
 */
namespace erdiko\core\cache;
use erdiko\core\cache\CacheInterface;

/**
 * Memcached Class
 */
class Memcached implements CacheInterface 
{
	/**
     * Memcached Object
     */
	protected $memcacheObj;
	
	/**
     * Constructor
     */
	public function __construct()
	{
		// Connection creation
		$this->memcacheObj = new \Memcached;
		$cacheAvailable = $this->memcacheObj->addServer(MEMCACHED_HOST, MEMCACHED_PORT);

	}

	/**
     * Destructor
     */
	public function __destruct()
	{
		$this->memcacheObj->quit();
		unset($this->memcacheObj);
	}

	/**
     * 	Get Cache Object
     *
     *	@return Memcache $memcacheObj 
     *  @note   Please do not modify data if you use the put function in this class
     */
	public function getObject()
	{
		return $this->memcacheObj;
	}

	/**
     * 	MD5 encode
     *
     *	@parm mixed $key
     *	@return string $key
     */<commit_msg>Added support of cache.json to Memcached class.<commit_after><?php
/**
 * Cache using the filesystem
 * 
 * @category 	Erdiko
 * @package  	core
 * @copyright 	Copyright (c) 2014, Arroyo Labs, www.arroyolabs.com
 * @author		<NAME>
 * @author		<NAME>, <EMAIL>
 */
namespace erdiko\core\cache;
use erdiko\core\cache\CacheInterface;

/**
 * Memcached Class
 */
class Memcached implements CacheInterface 
{
	/**
     * Memcached Object
     */
	protected $memcacheObj;
	
	/**
     * Constructor
     */
	public function __construct()
	{
		// Connection creation
		$this->memcacheObj = new \Memcached;

		$config = \Erdiko::getConfig("local/cache");
		$host=$config["memcached"]["host"];				
		$port=$config["memcached"]["port"];
		$cacheAvailable = $this->memcacheObj->addServer($host, $port);

	}

	/**
     * Destructor
     */
	public function __destruct()
	{
		$this->memcacheObj->quit();
		unset($this->memcacheObj);
	}

	/**
     * 	Get Cache Object
     *
     *	@return Memcache $memcacheObj 
     *  @note   Please do not modify data if you use the put function in this class
     */
	public function getObject()
	{
		return $this->memcacheObj;
	}

	/**
     * 	MD5 encode
     *
     *	@parm mixed $key
     *	@return string $key
     */
{'fraction_non_alphanumeric': 0.13877028181041845, 'fraction_numerical': 0.004269854824935952, 'mean_word_length': 2.7608346709470304, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4314796', 'n_tokens_mistral': 846, 'n_tokens_neox': 800, 'n_words': 184}