3 abstract class PhabricatorCacheSpec
extends Phobject
{
6 private $isEnabled = false;
8 private $clearCacheCallback = null;
9 private $issues = array();
11 private $usedMemory = 0;
12 private $totalMemory = 0;
13 private $entryCount = null;
15 public function setName($name) {
20 public function getName() {
24 public function setIsEnabled($is_enabled) {
25 $this->isEnabled
= $is_enabled;
29 public function getIsEnabled() {
30 return $this->isEnabled
;
33 public function setVersion($version) {
34 $this->version
= $version;
38 public function getVersion() {
39 return $this->version
;
42 protected function newIssue($key) {
43 $issue = id(new PhabricatorSetupIssue())
45 $this->issues
[$key] = $issue;
50 public function getIssues() {
54 public function setUsedMemory($used_memory) {
55 $this->usedMemory
= $used_memory;
59 public function getUsedMemory() {
60 return $this->usedMemory
;
63 public function setTotalMemory($total_memory) {
64 $this->totalMemory
= $total_memory;
68 public function getTotalMemory() {
69 return $this->totalMemory
;
72 public function setEntryCount($entry_count) {
73 $this->entryCount
= $entry_count;
77 public function getEntryCount() {
78 return $this->entryCount
;
81 protected function raiseInstallAPCIssue() {
83 "Installing the PHP extension 'APC' (Alternative PHP Cache) will ".
84 "dramatically improve performance. Note that APC versions 3.1.14 and ".
85 "3.1.15 are broken; 3.1.13 is recommended instead.");
88 ->newIssue('extension.apc')
89 ->setShortName(pht('APC'))
90 ->setName(pht("PHP Extension 'APC' Not Installed"))
91 ->setMessage($message)
92 ->addPHPExtension('apc');
95 protected function raiseEnableAPCIssue() {
96 $summary = pht('Enabling APC/APCu will improve performance.');
98 'The APC or APCu PHP extensions are installed, but not enabled in your '.
99 'PHP configuration. Enabling these extensions will improve performance. '.
100 'Edit the "%s" setting to enable these extensions.',
104 ->newIssue('extension.apc.enabled')
105 ->setShortName(pht('APC/APCu Disabled'))
106 ->setName(pht('APC/APCu Extensions Not Enabled'))
107 ->setSummary($summary)
108 ->setMessage($message)
109 ->addPHPConfig('apc.enabled');
112 public function setClearCacheCallback($callback) {
113 $this->clearCacheCallback
= $callback;
117 public function getClearCacheCallback() {
118 return $this->clearCacheCallback
;