質問

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