PHP Classes


Recommend this page to a friend!
  Classes of victor   Tuadmin Cache   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Tuadmin Cache
Cache variable value in file or session variable
Author: By
Last change: Update
Date: 4 years ago
Size: 1,081 bytes


Class file image Download


system for caching data

-(new file($PATH_FOLDER_CACHE))->{ANY_ID}($callback,$seconds_cache)
-(new session())->{ANY_ID}($callback,$seconds_cache)

Cache in static files

require 'tuadmin\cache.php';
$cache = new tuadmin\cache\file(__DIR__ .'/tmp');

Cache in session

require 'tuadmin\cache.php';
$cache = new tuadmin\cache\session(md5('var_in_session'));//alternative for name ,cache in $__SESSION[md5('var_in_session')]

Use object cache

$variable_key= '123';//for use in identifier
$var = $cache->{"id_is_$variable_key"}(function()use($variable_key){
	return array(time()." this is cached for var".$variable_key);

echo $var[0];

example for only tuadmin\cache\file and result is ever string

echo $cache->_("id_is_for_ever_string",function(){
	return time()." this is cached for var";

Haga clic aquí para prestar su apoyo a: donaciones para más proyectos y hacer una donación al PAYPAL!