public static function delete($key)
 {
     if ($row = self::find(crc32($key))) {
         $row->delete();
     }
     DbSession::search('expired_at < ' . time())->delete();
 }
Beispiel #2
0
    }
    /**
     *
     * @param number $maxWait            
     */
    public function setMaxWait($maxWait)
    {
        $this->maxWait = $maxWait;
    }
    /**
     *
     * @param number $minEvictableIdleTimeMillis            
     */
    public function setMinEvictableIdleTimeMillis($minEvictableIdleTimeMillis)
    {
        $this->minEvictableIdleTimeMillis = $minEvictableIdleTimeMillis;
    }
    /**
     *
     * @param number $timeBetweenEvictionRunsMillis            
     */
    public function setTimeBetweenEvictionRunsMillis($timeBetweenEvictionRunsMillis)
    {
        $this->timeBetweenEvictionRunsMillis = $timeBetweenEvictionRunsMillis;
    }
}
DbSession::$session = new DbSessionFactory();
$connect = DbSession::$session->getConnect();
echo DbSession::$session->currentActive . "\n";
$connect->close();
echo DbSession::$session->currentActive . "\n";
 /**
  * Create nonce for server and salt, expiring after 
  * $Auth_OpenID_SKEW seconds.
  */
 function useNonce($server_url, $timestamp, $salt)
 {
     global $Auth_OpenID_SKEW;
     // save one request to memcache when nonce obviously expired
     if (abs($timestamp - time()) > $Auth_OpenID_SKEW) {
         return false;
     }
     // returns false when nonce already exists
     // otherwise adds nonce
     if (DbSession::get('openid_nonce_' . sha1($server_url) . '_' . sha1($salt))) {
         return false;
     }
     DbSession::set('openid_nonce_' . sha1($server_url) . '_' . sha1($salt), 1);
     return true;
 }