public function set($key, $value) { if (is_null($this->writer)) { throw new MWException(__CLASS__ . ': must call startWrite() before calling set()'); } try { $this->writer->set($key, serialize($value)); } catch (Exception $e) { throw new MWException($e->getMessage()); } }