-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding memcache class for IT to utilize.
- Loading branch information
1 parent
9f56cca
commit d152ee9
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |||
} | |||
|
|||
} |