public function remove() { if (!$this->exists()) { return false; } // Find all of the keys used to store answers $answerKeys = array(); foreach ($this->questions as $questionID => $question) { foreach ($question['answers'] as $answerID => $answer) { $answerKeys[] = "Survey:{$this->id}:{$questionID}:{$answerID}"; } } // Remove all of the answer sets if (count($answerKeys)) { call_user_func_array(array('Redis', 'del'), $answerKeys); } parent::remove(); }
public function save() { parent::save(); Redis::set("User:username:{$this->username}", $this->id); }