Changeset View
Changeset View
Standalone View
Standalone View
src/applications/cache/PhabricatorKeyValueDatabaseCache.php
| Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | private function digestKeys(array $keys) { | ||||
| foreach ($keys as $key) { | foreach ($keys as $key) { | ||||
| $map[$key] = PhabricatorHash::digestForIndex($key); | $map[$key] = PhabricatorHash::digestForIndex($key); | ||||
| } | } | ||||
| return $map; | return $map; | ||||
| } | } | ||||
| private function willWriteValue($key, $value) { | private function willWriteValue($key, $value) { | ||||
| if (!is_string($value)) { | if (!is_string($value)) { | ||||
| throw new Exception("Only strings may be written to the DB cache!"); | throw new Exception('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'); | PhabricatorEnv::getEnvConfig('cache.enable-deflate'); | ||||
| } | } | ||||
| Show All 9 Lines | /* -( Implementation )----------------------------------------------------- */ | ||||
| private function didReadValue($format, $value) { | private function didReadValue($format, $value) { | ||||
| switch ($format) { | switch ($format) { | ||||
| case self::CACHE_FORMAT_RAW: | case self::CACHE_FORMAT_RAW: | ||||
| return $value; | return $value; | ||||
| case self::CACHE_FORMAT_DEFLATE: | case self::CACHE_FORMAT_DEFLATE: | ||||
| return PhabricatorCaches::inflateData($value); | return PhabricatorCaches::inflateData($value); | ||||
| default: | default: | ||||
| throw new Exception("Unknown cache format."); | throw new Exception('Unknown cache format.'); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||