redis!==false){ $result = $this->redis->hGet('pali://sent/' . $book . "_" . $para . "_" . $start . "_" . $end, "id"); if($result!==FALSE){ return $result; } } $id=0; $query = "SELECT id from pali_sent where book = ? and paragraph = ? and begin=? and end=?"; $stmt = $this->dbh->prepare($query); $stmt->execute(array($book,$para,$start,$end)); $result = $stmt->fetch(PDO::FETCH_ASSOC); if ($result) { $id= $result["id"]; } $output = $this->redis->hSet('pali://sent/' . $book . "_" . $para . "_" . $start . "_" . $end, "id",$id); return $id; } else { return 0; } } public function getInfo($id) { $query = "SELECT book,paragraph, begin,end from pali_sent where id = ? "; $stmt = $this->dbh->prepare($query); $stmt->execute(array($id)); $result = $stmt->fetch(PDO::FETCH_ASSOC); if ($result) { return $result; } return false; } } ?>