Auth_OpenID_PredisStore::storeAssociation PHP Метод

storeAssociation() публичный Метод

Overwrites any existing association with same server_url and handle. Handles list of associations for every server.
public storeAssociation ( $server_url, $association )
    function storeAssociation($server_url, $association)
    {
        // create Redis keys for association itself
        // and list of associations for this server
        $associationKey = $this->associationKey($server_url, $association->handle);
        $serverKey = $this->associationServerKey($server_url);
        // save association to server's associations' keys list
        $this->redis->lpush($serverKey, $associationKey);
        // Will touch the association list expiration, to avoid filling up
        $newExpiration = $association->issued + $association->lifetime;
        $expirationKey = $serverKey . '_expires_at';
        $expiration = $this->redis->get($expirationKey);
        if (!$expiration || $newExpiration > $expiration) {
            $this->redis->set($expirationKey, $newExpiration);
            $this->redis->expireat($serverKey, $newExpiration);
            $this->redis->expireat($expirationKey, $newExpiration);
        }
        // save association itself, will automatically expire
        $this->redis->setex($associationKey, $newExpiration - time(), serialize($association));
    }