Properly cache swift v3 token

The V3 token has an export function. Without this the token is
effectively never cached.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-03-12 20:53:38 +01:00
parent 195db56c22
commit 1cf77b4483
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 6 additions and 1 deletions

View File

@ -60,7 +60,12 @@ class SwiftFactory {
}
private function cacheToken(Token $token, string $cacheKey) {
$this->cache->set($cacheKey . '/token', json_encode($token));
if ($token instanceof \OpenStack\Identity\v3\Models\Token) {
$value = json_encode($token->export());
} else {
$value = json_encode($token);
}
$this->cache->set($cacheKey . '/token', $value);
}
/**