Skip to content

Commit

Permalink
Adding memcache class for IT to utilize.
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonsavage committed Jun 4, 2012
1 parent 9f56cca commit d152ee9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Bugzilla.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
$wgAutoloadClasses['BugzillaCacheMysql'] = $cwd . '/cache/BugzillaCacheMysql.class.php'; $wgAutoloadClasses['BugzillaCacheMysql'] = $cwd . '/cache/BugzillaCacheMysql.class.php';
$wgAutoloadClasses['BugzillaCacheDummy'] = $cwd . '/cache/BugzillaCacheDummy.class.php'; $wgAutoloadClasses['BugzillaCacheDummy'] = $cwd . '/cache/BugzillaCacheDummy.class.php';
$wgAutoloadClasses['BugzillaCacheApc'] = $cwd . '/cache/BugzillaCacheApc.class.php'; $wgAutoloadClasses['BugzillaCacheApc'] = $cwd . '/cache/BugzillaCacheApc.class.php';
$wgAutoloadClasses['BugzillaCacheMemcache'] = $cwd . '/cache/BugzillaCacheMemcache.class.php';







Expand Down
35 changes: 35 additions & 0 deletions cache/BugzillaCacheMemcache.class.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

class BugzillaCacheMemcache implements BugzillaCacheI
{

protected $_memcache;

public function __construct() {
// As much as I detest using a global here, it is necessary to avoid
// needing to inject the $wgMemc object, thus breaking the usefulness
// of the interface. Using the $wgMemc object is important for the
// consistency of the code.
global $wgMemc;
$this->_memcache = $wgMemc;
}

public function set($key, $value, $ttl = 300) {
// Get the wikimedia key style expected
$key = wfMemcKey($key);
return $this->_memcache->set($key, $value, $ttl);
}

public function get($key) {
// Get the wikimedia key style expected
$key = wfMemcKey($key);
return $this->_memcache->get($key);
}

public function expire($key) {
// Get the wikimedia key style expected
$key = wfMemcKey($key);
return $this->_memcache->delete($key);
}

}

0 comments on commit d152ee9

Please sign in to comment.