<commit_before><?php
	#
	# $Id: cache-port.php,v 1.4 2007-02-13 23:13:13 dan Exp $
	#
	# Copyright (c) 2006-2007 DVL Software Limited
	#

// base class for caching
// Supplies methods for adding, removing, and retrieving.
//

define('CACHE_PORT_COMMITS', 'Commits');
define('CACHE_PORT_DETAIL',  'Detail');

class CachePort extends Cache {

	var $PageSize = 100;

	function CachePort() {
		return parent::Cache();
	}
	
	function PageSizeSet($PageSize) {
		$this->PageSize = $PageSize;
	}

	function Retrieve($Category, $Port, $CacheType = CACHE_PORT_COMMITS, $PageNum = 1) {
		$this->_Log("CachePort: Retrieving for $Category/$Port");
		$Key = $this->_PortKey($Category, $Port, $CacheType, $PageNum);
		$result = parent::Retrieve($Key);

		return $result;
	}

	function Add($Category, $Port, $CacheType = CACHE_PORT_COMMITS, $PageNum = 1) {
		$this->_Log("CachePort: Adding for $Category/$Port");

		$CategoryCacheDir = $this->CacheDir . '/ports/' . $Category;
		$Key = $this->_PortKey($Category, $Port, $CacheType, $PageNum);
		 
		if (!file_exists($CategoryCacheDir)) {
			$this->_Log("CachePort: creating directory $CategoryCacheDir");
			$old_mask = umask(0000);
			if (!mkdir($CategoryCacheDir, 0774)) {
				$this->_Log("CachePort: unable to create directory $CategoryCacheDir");
			}
			umask($old_mask);
		}

		$PortCacheDir = $CategoryCacheDir . '/' . $Port;
		if (!file_exists($PortCacheDir)) {
			$this->_Log("CachePort: creating directory $PortCacheDir");
			$old_mask = umask(0000);
			if (mkdir($PortCacheDir, 0774)) {
				$this->_Log("CachePort: unable to create directory $PortCacheDir");
			}
			umask($old_mask);
		}

		$result = 0;
		$result = parent::Add($Key);

		return $result;<commit_msg>Move to a ports/category-name/port-name caching format<commit_after><?php
	#
	# $Id: cache-port.php,v 1.5 2007-06-03 15:46:18 dan Exp $
	#
	# Copyright (c) 2006-2007 DVL Software Limited
	#

	require_once('cache.php');

// base class for caching
// Supplies methods for adding, removing, and retrieving.
//

define('CACHE_PORT_COMMITS', 'Commits');
define('CACHE_PORT_DETAIL',  'Detail');

class CachePort extends Cache {

	var $PageSize = 100;

	function CachePort() {
		return parent::Cache();
	}
	
	function PageSizeSet($PageSize) {
		$this->PageSize = $PageSize;
	}

	function Retrieve($Category, $Port, $CacheType = CACHE_PORT_COMMITS, $PageNum = 1) {
		$this->_Log("CachePort: Retrieving for $Category/$Port");
		$Key = $this->_PortKey($Category, $Port, $CacheType, $PageNum);
		$result = parent::Retrieve($Key);

		return $result;
	}

	function Add($Category, $Port, $CacheType = CACHE_PORT_COMMITS, $PageNum = 1) {
		$this->_Log("CachePort: Adding for $Category/$Port");

		$CacheDir = $this->CacheDir . '/ports/' . $Category . '/' . $Port;
		$Key = $this->_PortKey($Category, $Port, $CacheType, $PageNum);
		 
		if (!file_exists($CacheDir)) {
			$this->_Log("CachePort: creating directory $CategoryCacheDir");
			$old_mask = umask(0000);
			if (!mkdir($CategoryCacheDir, 0774, true)) {
				$this->_Log("CachePort: unable to create directory $CacheDir");
			}
			umask($old_mask);
		}

		$result = 0;
		$result = parent::Add($Key);

		return $result;
{'fraction_non_alphanumeric': 0.17040075733669927, 'fraction_numerical': 0.026506784474597665, 'mean_word_length': 4.474956822107081, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2333498', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1079, 'n_words': 244}