Replies: 1 comment 1 reply
-
Hi. Thanks for idea. It is interesting but the fact is for some cases empty response is valid. For each API the definition of failure is different. In one case it is empty response, in another case it is HTTP status code. Therefore, because of variety of cases, it is better to handle it specifically like you did. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Real life example:
There are API requests that sometimes fall, nothing comes in response.
And if we save empty data (ApiHelper::getData) in the cache, then we will receive emptiness until the cache expires.
I suggest adding an option to indicate that we don't want to store empty data in the cache.
Example in getOrSet() vendor/yiisoft/yii2/caching/Cache.php
I have added a new $saveEmpty argument which is enabled by default.
In my project I made a temporary solution.
I will be glad to feedback
Beta Was this translation helpful? Give feedback.
All reactions