examples/ExampleFabric.php
private function cacheToken(AccessToken $accessToken)
    {
        $tz = self::TIME_ZONE;
        $kvs = $this->getKeyValueStorage();

        $liveTimeInSec = Carbon::createFromTimestamp($accessToken->getExpires(), $tz)->diffInSeconds(Carbon::now($tz));

        $kvs->set(self::ACCESS_TOKEN_KEY, $accessToken->getToken());
        $kvs->expire(self::ACCESS_TOKEN_KEY, $liveTimeInSec);
        $kvs->set(self::REFRESH_TOKEN_KEY, $accessToken->getRefreshToken());
    }
private function cacheToken(AccessToken $accessToken)
    {
        $tz = self::TIME_ZONE;
        $kvs = $this->getKeyValueStorage();

        $liveTimeInSec = Carbon::createFromTimestamp($accessToken->getExpires(), $tz)->diffInSeconds(Carbon::now($tz));

        $kvs->set(self::ACCESS_TOKEN_KEY, $accessToken->getToken());
        $kvs->expire(self::ACCESS_TOKEN_KEY, $liveTimeInSec);
        $kvs->set(self::REFRESH_TOKEN_KEY, $accessToken->getRefreshToken());
    }
private function cacheToken ( AccessToken $ accessToken ) { $ tz = self :: TIME_ZONE ; $ kvs = $ this -> getKeyValueStorage ( ) ; $ liveTimeInSec = Carbon :: createFromTimestamp ( $ accessToken -> getExpires ( ) , $ tz ) -> diffInSeconds ( Carbon :: now ( $ tz ) ) ; $ kvs -> set ( self :: ACCESS_TOKEN_KEY , $ accessToken -> getToken ( ) ) ; $ kvs -> expire ( self :: ACCESS_TOKEN_KEY , $ liveTimeInSec ) ; $ kvs -> set ( self :: REFRESH_TOKEN_KEY , $ accessToken -> getRefreshToken ( ) ) ; }
Puts the given access token to the local cache

@param AccessToken $accessToken
Puts the given access token to the local cache