本文整理汇总了PHP中Memcached_DataObject::cacheKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Memcached_DataObject::cacheKey方法的具体用法?PHP Memcached_DataObject::cacheKey怎么用?PHP Memcached_DataObject::cacheKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memcached_DataObject
的用法示例。
在下文中一共展示了Memcached_DataObject::cacheKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_option_value
-k key Key to look up; other args are ignored
ENDOFHELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$karg = get_option_value('k');
if (!empty($karg)) {
$k = common_cache_key($karg);
} else {
$table = get_option_value('t');
if (empty($table)) {
die("No table or key specified\n");
}
$column = get_option_value('c');
if (empty($column)) {
$column = 'id';
}
$value = get_option_value('v');
$k = Memcached_DataObject::cacheKey($table, $column, $value);
}
print "Checking key '{$k}'...\n";
$c = common_memcache();
if (empty($c)) {
die("Can't initialize cache object!\n");
}
$obj = $c->get($k);
if (empty($obj)) {
print "Empty.\n";
} else {
var_dump($obj);
print "\n";
}
示例2: getcached
static function getcached($cls, $k, $v)
{
$c = Memcached_DataObject::memcache();
if (!$c) {
return false;
} else {
$obj = $c->get(Memcached_DataObject::cacheKey($cls, $k, $v));
if (0 == strcasecmp($cls, 'User')) {
// Special case for User
if (is_object($obj) && is_object($obj->id)) {
common_log(LOG_ERR, "User " . $obj->nickname . " was cached with User as ID; deleting");
$c->delete(Memcached_DataObject::cacheKey($cls, $k, $v));
return false;
}
}
return $obj;
}
}
示例3: multicache
function multicache($cls, $kv)
{
ksort($kv);
$c = Memcached_DataObject::memcache();
if (!$c) {
return false;
} else {
$pkeys = implode(',', array_keys($kv));
$pvals = implode(',', array_values($kv));
return $c->get(Memcached_DataObject::cacheKey($cls, $pkeys, $pvals));
}
}