Skip to content

Instantly share code, notes, and snippets.

@WoZ
Forked from anonymous/gist:1810066
Created February 12, 2012 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WoZ/1810148 to your computer and use it in GitHub Desktop.
Save WoZ/1810148 to your computer and use it in GitHub Desktop.
<?php
// ниже пример, когда существенно превышает длина строки 80 символов
// тут строка короче, но смысл тот же
// Вариант 1
if (! $memcache->waitForUnlock($mKey)
|| ! $b0 = $memcache->get($mKey)
) {
$memcache->log("$mKey unlocked but cache is empty");
$b0 = null;
}
// Вариант 2
if (! $memcache->waitForUnlock($mKey)
|| ! $b0 = $memcache->get($mKey))
{
$memcache->log("$mKey unlocked but cache is empty");
$b0 = null;
}
// Вариант 3
if (! $memcache->waitForUnlock($mKey)
|| ! $b0 = $memcache->get($mKey)) {
$memcache->log("$mKey unlocked but cache is empty");
$b0 = null;
}
// Третий вариант, как раз, менее читаем чем первый и второй
// альтернативный вариант
// Вариант 4
if (
! $memcache->waitForUnlock($mKey)
|| ! $b0 = $memcache->get($mKey)
) {
$memcache->log("$mKey unlocked but cache is empty");
$b0 = null;
}
// Вариант 5
if (
! $memcache->waitForUnlock($mKey)
|| ! $b0 = $memcache->get($mKey)
)
{
$memcache->log("$mKey unlocked but cache is empty");
$b0 = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment