문제

I am using the php-opencloud / Rackspace SDK.

I only have one user connecting to the API, which is the entire site that is running.

By default it will make an authentication request before every API call, which is of course crazy.

I want to simply cache the token (I'm thinking apc_add() / apc_fetch()) and then pass it in next time to prevent that extra API call. There will be one token for the whole site so this makes sense to me.

This is what I have but it's not recognising the data and it just keeps making the extra API call in line 2 anyway.

What am I doing wrong? How would I simply pass in a token to stop it making authentication API calls?

// uses https://github.com/rackspace/php-opencloud

$client->importCredentials(array('token'=>'the-token', 'expiration'=>'2014-03-01T01:02:09.384Z', 'tenant'=>'xxxxxxxx'));    

$queue = $client->queuesService('cloudQueues', 'LON', 'internalURL')->setClientId();
도움이 되었습니까?

해결책

When you implement caching, you'll want to use exportCredentials. If not, you'll manually have to make sure you have all the fields correctly set (namely, token, expiration, tenant, and catalog).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top