<commit_before><?php
class memcached_table extends table{
	function read($fields){
		if(extension_loaded('memcached')){
			$memcache = new Memcache;	
			$memcache->connect('***REMOVED***', 11211) or die ("Could not connect memcache");
			$this->execute = false;
			parent::read($fields);
			$this->execute = true;
			$query_hash = md5($this->sql);
			if($result = $memcache->get($query_hash)){
				echo 'memcached';
				return $result;
			}else{
				print("<br/>Query from DB<br/>");
				$result = parent::read();				
				$memcache->set($query_hash,$result,false,0);
			}
		}else{
			echo "no memcache";
			return parent::read($fields);
		}		
	}
}
?><commit_msg>memcache<commit_after><?php
class memcached_table extends table{
	function read($fields){
		if(extension_loaded('memcached')){
			$memcache = new memcached;	
			$memcache->connect('***REMOVED***', 11211) or die ("Could not connect memcache");
			$this->execute = false;
			parent::read($fields);
			$this->execute = true;
			$query_hash = md5($this->sql);
			if($result = $memcache->get($query_hash)){
				echo 'memcached';
				return $result;
			}else{
				print("<br/>Query from DB<br/>");
				$result = parent::read();				
				$memcache->set($query_hash,$result,false,0);
			}
		}else{
			echo "no memcache";
			return parent::read($fields);
		}		
	}
}
?>
{'fraction_non_alphanumeric': 0.19242424242424241, 'fraction_numerical': 0.010606060606060607, 'mean_word_length': 4.022813688212928, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, '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': '104522', 'n_tokens_mistral': 548, 'n_tokens_neox': 453, 'n_words': 90}