r92597 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92596‎ | r92597 | r92598 >
Date:23:09, 19 July 2011
Author:preilly
Status:ok
Tags:
Comment:
fix issues after code review
Modified paths:
  • /trunk/extensions/MobileFrontend/library/WURFL/Storage/Mwmemcache.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/library/WURFL/Storage/Mwmemcache.php
@@ -2,46 +2,52 @@
33
44 class WURFL_Storage_Mwmemcache extends WURFL_Storage_Base {
55
6 - private $expiration;
7 - private $namespace;
 6+ private $expiration;
 7+ private $namespace;
88
9 - private $defaultParams = array(
10 - "host" => "127.0.0.1",
11 - "port" => "11211",
12 - "namespace" => "wurfl",
13 - "expiration" => 0
14 - );
 9+ private $defaultParams = array(
 10+ "namespace" => "wurfl",
 11+ "expiration" => 0
 12+ );
1513
16 - public function __construct($params=array()) {
 14+ public function __construct($params=array()) {
1715 $currentParams = is_array($params) ? array_merge($this->defaultParams, $params) : $this->defaultParams;
18 - $this->toFields($currentParams);
19 - }
 16+ $this->toFields($currentParams);
 17+ }
2018
21 - private function toFields($params) {
22 - foreach($params as $key => $value) {
23 - $this->$key = $value;
24 - }
25 - }
 19+ private function toFields($params) {
 20+ foreach($params as $key => $value) {
 21+ $this->$key = $value;
 22+ }
 23+ }
2624
27 - /**
28 - * Saves the object.
29 - *
30 - * @param string $objectId
31 - * @param mixed $object
32 - * @return
33 - */
34 - public function save($objectId, $object) {
 25+ /**
 26+ * Saves the object.
 27+ *
 28+ * @param string $objectId
 29+ * @param mixed $object
 30+ * @return
 31+ */
 32+ public function save($objectId, $object) {
3533 global $wgMemc;
3634 return $wgMemc->set( $this->encode( $this->namespace, $objectId ), $object, $this->expiration );
37 - }
 35+ }
3836
39 - public function load($objectId) {
40 - global $wgMemc;
 37+
 38+ /**
 39+ * Load the object.
 40+ *
 41+ * @param string $objectId
 42+ * @param mixed $object
 43+ * @return
 44+ */
 45+ public function load($objectId) {
 46+ global $wgMemc;
4147 $value = $wgMemc->get( $this->encode( $this->namespace, $objectId ) );
42 - return $value ? $value : null;
43 - }
 48+ return $value;
 49+ }
4450
4551
46 - public function clear() {
47 - }
 52+ public function clear() {
 53+ }
4854 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91768WURFL support in MW Memcache interfacepreilly22:50, 8 July 2011

Status & tagging log