File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -175,9 +175,7 @@ public function invalidateCacheByWSRequest(WSRequest $request): void
175175 private function buildCacheId (WSRequest $ request ): string
176176 {
177177 return $ request ->webService . '- ' . $ request ->subService . '- ' . $ request ->action
178- . md5 (
179- serialize ($ request ->getRequestParams ())
180- );
178+ . md5 (serialize ($ request ->getCacheParams ()));
181179 }
182180
183181 private function sanitizeArray (array $ array ): array
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ class WSRequest
1515 */
1616 private array $ options = [];
1717
18+ private array $ cacheVaryingParams = [];
19+
1820 public function __construct (
1921 public readonly string $ webService ,
2022 public readonly string $ action ,
@@ -155,4 +157,21 @@ public function setTimeout(float $timeout): static
155157
156158 return $ this ;
157159 }
160+
161+ public function setCacheVaryingParams (array $ params ): static
162+ {
163+ $ this ->cacheVaryingParams = $ params ;
164+
165+ return $ this ;
166+ }
167+
168+ public function getCacheParams (): array
169+ {
170+ $ requestParams = $ this ->getRequestParams ();
171+ $ varyingParams = $ this ->cacheVaryingParams ;
172+ ksort ($ requestParams );
173+ ksort ($ varyingParams );
174+
175+ return array_merge ($ requestParams , $ varyingParams );
176+ }
158177}
You can’t perform that action at this time.
0 commit comments