diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index d39b59b23e4a2fea525bed613c7b49dded5a9378..f377e9777d68bd4b98a2932970cbdc102c01a1be 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -259,8 +259,9 @@ class Cache {
 			}
 
 			// The file was created in the mean time
+			$id = $this->getId($file);
 			$this->update($id, $data);
-			return $this->getId($file);
+			return $id;
 		}
 	}