@@ -49,7 +49,7 @@ public static function load(string $cacheFile): self
4949 throw new DbaException (sprintf ('Cache file "%s" is not readable ' , $ cacheFile ));
5050 }
5151
52- $ cache = include $ cacheFile ;
52+ $ cache = require $ cacheFile ;
5353
5454 $ reflectionCache = new self ($ cacheFile );
5555 if (\is_array ($ cache ) && \array_key_exists ('schemaVersion ' , $ cache ) && self ::SCHEMA_VERSION === $ cache ['schemaVersion ' ]) {
@@ -109,11 +109,14 @@ public function putValidationError(string $queryString, ?Error $error): void
109109 {
110110 if (!\array_key_exists ($ queryString , $ this ->records )) {
111111 $ this ->records [$ queryString ] = [];
112+ $ this ->changed = true ;
112113 }
113114
114115 $ cacheEntry = &$ this ->records [$ queryString ];
115- $ cacheEntry ['error ' ] = $ error ;
116- $ this ->changed = true ;
116+ if (!\array_key_exists ('error ' , $ cacheEntry ) || $ cacheEntry ['error ' ] !== $ error ) {
117+ $ cacheEntry ['error ' ] = $ error ;
118+ $ this ->changed = true ;
119+ }
117120 }
118121
119122 /**
@@ -161,14 +164,18 @@ public function putResultType(string $queryString, int $fetchType, ?Type $result
161164 {
162165 if (!\array_key_exists ($ queryString , $ this ->records )) {
163166 $ this ->records [$ queryString ] = [];
167+ $ this ->changed = true ;
164168 }
165169
166170 $ cacheEntry = &$ this ->records [$ queryString ];
167171 if (!\array_key_exists ('result ' , $ cacheEntry )) {
168172 $ cacheEntry ['result ' ] = [];
173+ $ this ->changed = true ;
169174 }
170175
171- $ cacheEntry ['result ' ][$ fetchType ] = $ resultType ;
172- $ this ->changed = true ;
176+ if (!\array_key_exists ($ fetchType , $ cacheEntry ['result ' ]) || $ cacheEntry ['result ' ][$ fetchType ] !== $ resultType ) {
177+ $ cacheEntry ['result ' ][$ fetchType ] = $ resultType ;
178+ $ this ->changed = true ;
179+ }
173180 }
174181}
0 commit comments