From 4e8d5504d2acf27a25e1d2068dea06faa3604a39 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 12 Mar 2018 20:53:38 +0100 Subject: [PATCH] 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 --- lib/private/Files/ObjectStore/SwiftFactory.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php index 9513cdc3ab..eab3441ff2 100644 --- a/lib/private/Files/ObjectStore/SwiftFactory.php +++ b/lib/private/Files/ObjectStore/SwiftFactory.php @@ -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); } /**