Example #1
0
 /**
  * method: getInstance
  * 
  * creates and returns instance of ConnectionCache if instance does not exist, otherwise returns instance if
  * instance already exists
  * 
  *  returns:
  * 
  * 		instance	 of ConnectionCache
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new connectionCache();
     }
     return self::$instance;
 }
 /**
  * method: disconnect
  * 
  * disconnect database connection
  * 
  * returns:
  * 
  * 		boolean indicating if disconnect was successful
  */
 public function disconnect()
 {
     if (!@mysqli_close($this->conn)) {
         $this->error = new DataAccessError("CLOSE", mysqli_errno(), mysqli_error());
         throw new DAOException('Could not close connection, reason: ' . $this->error->getErrorStr());
     }
     return ConnectionCache::getInstance()->removeEntry($this);
 }