| Index: trunk/extensions/MobileFrontend/library/WURFL/Storage/Mwmemcache.php |
| — | — | @@ -2,46 +2,52 @@ |
| 3 | 3 | |
| 4 | 4 | class WURFL_Storage_Mwmemcache extends WURFL_Storage_Base { |
| 5 | 5 | |
| 6 | | - private $expiration; |
| 7 | | - private $namespace; |
| | 6 | + private $expiration; |
| | 7 | + private $namespace; |
| 8 | 8 | |
| 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 | + ); |
| 15 | 13 | |
| 16 | | - public function __construct($params=array()) { |
| | 14 | + public function __construct($params=array()) { |
| 17 | 15 | $currentParams = is_array($params) ? array_merge($this->defaultParams, $params) : $this->defaultParams; |
| 18 | | - $this->toFields($currentParams); |
| 19 | | - } |
| | 16 | + $this->toFields($currentParams); |
| | 17 | + } |
| 20 | 18 | |
| 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 | + } |
| 26 | 24 | |
| 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) { |
| 35 | 33 | global $wgMemc; |
| 36 | 34 | return $wgMemc->set( $this->encode( $this->namespace, $objectId ), $object, $this->expiration ); |
| 37 | | - } |
| | 35 | + } |
| 38 | 36 | |
| 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; |
| 41 | 47 | $value = $wgMemc->get( $this->encode( $this->namespace, $objectId ) ); |
| 42 | | - return $value ? $value : null; |
| 43 | | - } |
| | 48 | + return $value; |
| | 49 | + } |
| 44 | 50 | |
| 45 | 51 | |
| 46 | | - public function clear() { |
| 47 | | - } |
| | 52 | + public function clear() { |
| | 53 | + } |
| 48 | 54 | } |