Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improving the caching mechanism, in preparation for providing a memca…

…che option for IT to utilize in production.
  • Loading branch information...
commit 9f56cca557010e28466333b15ffd9807f354b836 1 parent 49d18d7
@brandonsavage brandonsavage authored
View
2  Bugzilla.php
@@ -37,6 +37,8 @@
$wgAutoloadClasses['BugzillaCacheI'] = $cwd . '/cache/BugzillaCacheI.class.php';
$wgAutoloadClasses['BugzillaCacheMysql'] = $cwd . '/cache/BugzillaCacheMysql.class.php';
$wgAutoloadClasses['BugzillaCacheDummy'] = $cwd . '/cache/BugzillaCacheDummy.class.php';
+$wgAutoloadClasses['BugzillaCacheApc'] = $cwd . '/cache/BugzillaCacheApc.class.php';
+
/**
View
2  BugzillaOutput.class.php
@@ -147,7 +147,7 @@ public function setup_template_data() {
$key = md5($this->query->id . $this->_get_size() . get_class($this));
$cache = $this->_getCache();
if($result = $cache->get($key)) {
- $image = $result['data'];
+ $image = $result;
$this->response->image = $wgBugzillaChartUrl . '/' . $image;
} else {
$this->response->image = $wgBugzillaChartUrl . '/' . $this->generate_chart($key) . '.png';
View
4 BugzillaQuery.class.php
@@ -133,9 +133,7 @@ public function fetch() {
}else {
// Cache is good, use it
- $this->id = $row['id'];
- $this->fetched_at = wfTimestamp(TS_DB, $row['fetched_at']);
- $this->data = unserialize($row['data']);
+ $this->data = unserialize($row);
$this->cached = TRUE;
}
}
View
18 cache/BugzillaCacheApc.class.php
@@ -0,0 +1,18 @@
+<?php
+
+class BugzillaCacheApc implements BugzillaCacheI
+{
+
+ public function set($key, $value, $ttl = 300) {
+ return apc_store($key, $value, $ttl);
+ }
+
+ public function get($key) {
+ return apc_fetch($key);
+ }
+
+ public function expire($key) {
+ return apc_delete($key);
+ }
+
+}
View
2  cache/BugzillaCacheMysql.class.php
@@ -54,7 +54,7 @@ public function get($key)
return;
}
- return $row;
+ return $row['data'];
}
public function expire($key)
Please sign in to comment.
Something went wrong with that request. Please try again.