PHP Classes

File: README.md

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

Contents

Class file image Download

tuadmin.cache

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

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

Cache in session

<?php
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

$cache_expire_in=3600;//seconds
$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);
},$cache_expire_in);

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";
},60);

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