캐쉬 사용 함수 캐쉬 삭제 clearstatcache 사용 간편하게.

clearstatcache

(PHP 3, PHP 4, PHP 5)

clearstatcache -- 파일의 통계(stat) 캐시를 삭제합니다.

Description

void clearstatcache ( void )

대부분의 운영체제에서statlstat등의 시스템호출을 사용해서 일을하는 것은 꽤 자원을 많이 소모합니다. 그렇기 때문에 최종적으로 사용된 상태를 나타내는 함수(아래에 나열된)의 결과는 다음번에 같은 파일이름을 사용하여 그런 호출을 할 경우를 위하여 저장이 됩니다. 만약에 파일이 여러번 체크가 되었고 파일이 바뀌거나 파일이 없어졌을 경우등에 상태를 강제로 다시 체크하고자 한다면 이 함수를 사용하여 저장되어있는 최종결과를 메모리에서 삭제할 수 있습니다.

이 값은 어떤 단일 요청(request)이 유효할 때까지만 캐시된 값입니다.

Affected functions include stat(), lstat(), file_exists(), is_writable(), is_readable(), is_executable(), is_file(), is_dir(), is_link(), filectime(), fileatime(), filemtime(), fileinode(), filegroup(), fileowner(), filesize(), filetype(), and fileperms().



/**
* Document info
* @project
* @modifydate 
* @filename
* @author RedCat 
* @version
* @package
* @comment
*/

/**
* 캐쉬 사용 함수 캐쉬 삭제
*/
class fs {
	function stat($fpth) {
		$arr = @stat($fpth);
		clearstatcache();
		return $arr;
	}
	function lstat($fpth) {
		$arr = @lstat($fpth);
		clearstatcache();
		return $arr;
	}
	function file_exists($fpth) {
		$r = @file_exists($fpth);
		clearstatcache();
		return $r;
	}
	function is_writable($fpth) {
		$r = @is_writable($fpth);
		clearstatcache();
		return $r;
	}
	function is_readable($fpth) {
		$r = @is_readable($fpth);
		clearstatcache();
		return $r;
	}
	function is_executable($fpth) {
		$r = @is_executable($fpth);
		clearstatcache();
		return $r;
	}
	function is_file($fpth) {
		$r = @is_file($fpth);
		clearstatcache();
		return $r;
	}
	function is_dir($fpth) {
		$r = @is_dir($fpth);
		clearstatcache();
		return $r;
	}
	function is_link($fpth) {
		$r = @is_link($fpth);
		clearstatcache();
		return $r;
	}
	function filectime($fpth) {
		$r = @filectime($fpth);
		clearstatcache();
		return $r;
	}
	function fileatime($fpth) {
		$r = @fileatime($fpth);
		clearstatcache();
		return $r;
	}
	function filemtime($fpth) {
		$r = @filemtime($fpth);
		clearstatcache();
		return $r;
	}
	function fileinode($fpth) {
		$r = @fileinode($fpth);
		clearstatcache();
		return $r;
	}
	function filegroup($fpth) {
		$r = @filegroup($fpth);
		clearstatcache();
		return $r;
	}
	function fileowner($fpth) {
		$r = @fileowner($fpth);
		clearstatcache();
		return $r;
	}
	function filesize($fpth) {
		$r = @filesize($fpth);
		clearstatcache();
		return $r;
	}
	function filetype($fpth) {
		$r = @filetype($fpth);
		clearstatcache();
		return $r;
	}
	function fileperms($fpth) {
		$r = @fileperms($fpth);
		clearstatcache();
		return $r;
	}
}

'PHP' 카테고리의 다른 글

if($a = $b)  (0) 2010.05.10
ASP / PHP Cross Reference  (0) 2010.04.14
쉘상에서 php 코드 구동하기  (0) 2009.10.15
날짜,시간 포맷,계산 관련 함수  (0) 2008.12.13
php4 이하에서의 scandir  (0) 2008.12.13