<?php

	# mark core  v1.0
    # author Drk in
	# date 24.10.19 

	# class cache user

	class cache_user {

		public static function get($CK) # get
		{
		
		$file = cache."_user/{$CK}.data";	
		$cache = @file_get_contents($file); 	
		return unserialize($cache);

		}	

		public static function save($CK) # save
		{
		
		$file = cache."_user/{$CK}.data";	
		$cache = DB :: $dbh -> queryFetch("SELECT * FROM user WHERE CK = ? LIMIT 1;", array($CK));        
		$cache = serialize($cache);	
		@file_put_contents($file, $cache);

		}

	
		public static function check($CK) # check
		{
		
		$file = cache."_user/{$CK}.data";	
		if(!file_exists($file)):  	
		self::save($CK);
		endif;
		return self::get($CK);

		}

		public static function ch($CK) # check file
		{
		
		$file = cache."_user/{$CK}.data";	
		if(file_exists($file)):  
		return true;
		else:	
		return false;
		endif;	

		}	

		


	}	
?>