Example #1
0
 /**
  * When you're going to sleep the script execution for a longer time
  * it is good to close all external connections (sql, memcache, SMTP, IMAP).
  *
  * No action is required on wake up, all connections will be
  * re-established automatically.
  */
 public function sleep()
 {
     foreach ($this->caches as $cache) {
         if (is_object($cache)) {
             $cache->close();
         }
     }
     if ($this->storage) {
         $this->storage->close();
     }
     if ($this->db) {
         $this->db->closeConnection();
     }
     if ($this->memcache) {
         $this->memcache->close();
         // after close() need to re-init memcache
         $this->memcache_init();
     }
     if ($this->smtp) {
         $this->smtp->disconnect();
     }
 }
Example #2
0
 /**
  * Terminate database connection.
  */
 public function closeConnection()
 {
     // release statement and close connection(s)
     $this->last_result = null;
     foreach ($this->dbhs as $dbh) {
         oci_close($dbh);
     }
     parent::closeConnection();
 }