Changeset View
Changeset View
Standalone View
Standalone View
src/applications/cache/PhabricatorKeyValueDatabaseCache.php
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | /* -( Implementation )----------------------------------------------------- */ | ||||
private function willWriteValue($key, $value) { | private function willWriteValue($key, $value) { | ||||
if (!is_string($value)) { | if (!is_string($value)) { | ||||
throw new Exception(pht('Only strings may be written to the DB cache!')); | throw new Exception(pht('Only strings may be written to the DB cache!')); | ||||
} | } | ||||
static $can_deflate; | static $can_deflate; | ||||
if ($can_deflate === null) { | if ($can_deflate === null) { | ||||
$can_deflate = function_exists('gzdeflate') && | $can_deflate = function_exists('gzdeflate'); | ||||
PhabricatorEnv::getEnvConfig('cache.enable-deflate'); | |||||
} | } | ||||
if ($can_deflate) { | if ($can_deflate) { | ||||
$deflated = PhabricatorCaches::maybeDeflateData($value); | $deflated = PhabricatorCaches::maybeDeflateData($value); | ||||
if ($deflated !== null) { | if ($deflated !== null) { | ||||
return array(self::CACHE_FORMAT_DEFLATE, $deflated); | return array(self::CACHE_FORMAT_DEFLATE, $deflated); | ||||
} | } | ||||
} | } | ||||
Show All 17 Lines |