Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
Автодополнение работает на ураЭто весомый плюс? о_О
//Until php 5.3 we won't have late static binding or some sane way to get static child class name. get_class() failsВы еще думаете что Синглтон это круто? кстати эта проблема и до 5.3 обходится.
protected static $provider = «MemcacheTag»; //So we hardcode it and create new
Мне не нравится ZF. Это принципиально.
error_reporting(E_ALL);
require_once("CacheTag.class.php");
function f()
{
return 2;
}
CacheTag::SetBackend('Memcache');
CacheTag::SetFunction('f');
CacheTag::SetTags(CacheTag::TAG_PRODUCT);
$res = CacheTag::Fetch().'<br>';
echo $res;
SetBackend abstract class CacheTag
SetFunction abstract class CacheTag
GetInstance abstract class CacheTag
ImportBackend abstract class CacheTag
Memcache construct
__construct abstract class CacheTag
Memcache Get
SetTags abstract class CacheTag
GetInstance abstract class CacheTag
Fetch abstract class CacheTag
GetInstance abstract class CacheTag
Prepare abstract class CacheTag
GetVarName abstract class CacheTag
Memcache Get
IsRegistered abstract class CacheTag
GetFunctionValue abstract class CacheTag
ApplyTagsChange abstract class CacheTag
Memcache Set
ResetSettings abstract class CacheTag
2
__destruct abstract class CacheTag
SaveResetTags abstract class CacheTag
Memcache Replace
error_reporting(E_ALL);
require_once("CacheTag.class.php");
function f()
{
return rand(1,1000);
}
CacheTag::SetBackend(CacheTag::BACKEND_MEMCACHE);
CacheTag::SetFunction('f');
CacheTag::SetTags(CacheTag::TAG_PRODUCT);
//CacheTag::SetParam(CacheTag::PARAM_ID, 2);
CacheTag::SetTimeout(0);
$var=CacheTag::Fetch();
echo $var;
CacheTag::Flush();
* This source code was highlighted with Source Code Highlighter.//Adding another var (note the new param)
CacheTag::SetFunction('f2');
CacheTag::SetTags(CacheTag::TAG_PRODUCT);
CacheTag::SetParam(CacheTag::PARAM_ID, 2);
CacheTag::SetParam(CacheTag::PARAM_USER, 7);
CacheTag::SetTimeout(0.1);
CacheTag::Fetch();
//Deleting vars tagged with Product and with param id = 2
CacheTag::SetTags(CacheTag::TAG_PRODUCT);
CacheTag::SetParam(CacheTag::PARAM_ID, 2);
CacheTag::Flush();
Php + Cache + Tags = phpCacheTag