Path: blob/master/src/applications/cache/spec/PhabricatorCacheSpec.php
12242 views
<?php12abstract class PhabricatorCacheSpec extends Phobject {34private $name;5private $isEnabled = false;6private $version;7private $clearCacheCallback = null;8private $issues = array();910private $usedMemory = 0;11private $totalMemory = 0;12private $entryCount = null;1314public function setName($name) {15$this->name = $name;16return $this;17}1819public function getName() {20return $this->name;21}2223public function setIsEnabled($is_enabled) {24$this->isEnabled = $is_enabled;25return $this;26}2728public function getIsEnabled() {29return $this->isEnabled;30}3132public function setVersion($version) {33$this->version = $version;34return $this;35}3637public function getVersion() {38return $this->version;39}4041protected function newIssue($key) {42$issue = id(new PhabricatorSetupIssue())43->setIssueKey($key);44$this->issues[$key] = $issue;4546return $issue;47}4849public function getIssues() {50return $this->issues;51}5253public function setUsedMemory($used_memory) {54$this->usedMemory = $used_memory;55return $this;56}5758public function getUsedMemory() {59return $this->usedMemory;60}6162public function setTotalMemory($total_memory) {63$this->totalMemory = $total_memory;64return $this;65}6667public function getTotalMemory() {68return $this->totalMemory;69}7071public function setEntryCount($entry_count) {72$this->entryCount = $entry_count;73return $this;74}7576public function getEntryCount() {77return $this->entryCount;78}7980protected function raiseInstallAPCIssue() {81$message = pht(82"Installing the PHP extension 'APC' (Alternative PHP Cache) will ".83"dramatically improve performance. Note that APC versions 3.1.14 and ".84"3.1.15 are broken; 3.1.13 is recommended instead.");8586return $this87->newIssue('extension.apc')88->setShortName(pht('APC'))89->setName(pht("PHP Extension 'APC' Not Installed"))90->setMessage($message)91->addPHPExtension('apc');92}9394protected function raiseEnableAPCIssue() {95$summary = pht('Enabling APC/APCu will improve performance.');96$message = pht(97'The APC or APCu PHP extensions are installed, but not enabled in your '.98'PHP configuration. Enabling these extensions will improve performance. '.99'Edit the "%s" setting to enable these extensions.',100'apc.enabled');101102return $this103->newIssue('extension.apc.enabled')104->setShortName(pht('APC/APCu Disabled'))105->setName(pht('APC/APCu Extensions Not Enabled'))106->setSummary($summary)107->setMessage($message)108->addPHPConfig('apc.enabled');109}110111public function setClearCacheCallback($callback) {112$this->clearCacheCallback = $callback;113return $this;114}115116public function getClearCacheCallback() {117return $this->clearCacheCallback;118}119}120121122