diff --git a/lib/Phpfastcache/Extensions/Drivers/Ravendb/RavenProxy.php b/lib/Phpfastcache/Extensions/Drivers/Ravendb/RavenProxy.php index a5d25f9..57b90b0 100644 --- a/lib/Phpfastcache/Extensions/Drivers/Ravendb/RavenProxy.php +++ b/lib/Phpfastcache/Extensions/Drivers/Ravendb/RavenProxy.php @@ -143,18 +143,21 @@ public function fromCacheItem(ExtendedCacheItemInterface $item): void } /** - * @return array + * @return null|array */ - public function toDriverArray(): array - { - return [ - ExtendedCacheItemPoolInterface::DRIVER_KEY_WRAPPER_INDEX => $this->key, - ExtendedCacheItemPoolInterface::DRIVER_DATA_WRAPPER_INDEX => ($this->serializeData ? unserialize($this->data) : $this->data), - ExtendedCacheItemPoolInterface::DRIVER_EDATE_WRAPPER_INDEX => $this->expirationDate, - ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX => $this->creationDate, - ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX => $this->modificationDate, - TaggableCacheItemPoolInterface::DRIVER_TAGS_WRAPPER_INDEX => $this->tags, - ]; + public function toDriverArray(): ?array + { + if ($this->key) { + return [ + ExtendedCacheItemPoolInterface::DRIVER_KEY_WRAPPER_INDEX => $this->key, + ExtendedCacheItemPoolInterface::DRIVER_DATA_WRAPPER_INDEX => ($this->serializeData ? unserialize($this->data) : $this->data), + ExtendedCacheItemPoolInterface::DRIVER_EDATE_WRAPPER_INDEX => $this->expirationDate, + ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX => $this->creationDate, + ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX => $this->modificationDate, + TaggableCacheItemPoolInterface::DRIVER_TAGS_WRAPPER_INDEX => $this->tags, + ]; + } + return null; } public function setSerializeData(bool $serializeData): void