Context
2.2.3 introduced a call for user data on all admin pages. As a result, we perform calls to the Imagify API users/me much more often. However, the data from the API is not directly required on all admin pages, but rather on bulk & setting pages, as well as when opening the Imagify admin bar (which is on all admin pages).
A mitigation has been set with a response cache of 5 minutes with the transient imagify_user_cache. However, the number of calls to the API remains high overall, and further increasing the transient TTL would disrupt the freshness of the data as explained here.
Expected behavior
Highly reduce the number of calls to Imagify API users/me overall.
Ideally, as explained here, we should perform calls to the API only when really needed (bulk & settings pages, or when hovering the Imagify admin bar) and combine this with some caching for a short amount of time (as already done).
If this is not possible, other alternatives can be considered such as a longer cache time but providing a refresh button.
See the discussion here
Acceptance Criteria
The main acceptance criteria is that the number of calls to the Imagify App must be reduced overall. Exact ACs will depend on the approach selected (request only when needed or longer cache + refresh).
For "request only when needed":
With Imagify activated, when I clear the transients and browse admin pages (excluding bulk, settings) and not hovering the Imagify admin bar, no requests to users/me are done.
When hovering the Imagify admin bar, after a short amount of time, I can see my license type, my quota consumed and possibly the upsell banner (see upsell banner conditions)
With Imagify activated, when I clear the transients and browse admin pages for x minutes, I can see one request to users/me at first and then not anymore. x should be the cache duration (typically > 10 minutes).
In the Imagify admin bar, there is a refresh icon. When I have a free or growth plan and users/me response cached in transient, and then I optimize an image, I must not see the quota updated in the admin bar. Then I click the refresh button, the quota must be updated.
In the Imagify admin bar, there is a refresh icon. When I have a free plan and users/me response cached in transient, and then I update my plan on the Imagify website, I must not see the new plan in the Imagify admin bar.. Then I click the refresh button, the plan must be updated.
Context 2.2.3 introduced a call for user data on all admin pages. As a result, we perform calls to the Imagify API users/me much more often. However, the data from the API is not directly required on all admin pages, but rather on bulk & setting pages, as well as when opening the Imagify admin bar (which is on all admin pages). A mitigation has been set with a response cache of 5 minutes with the transient
imagify_user_cache
. However, the number of calls to the API remains high overall, and further increasing the transient TTL would disrupt the freshness of the data as explained here.Expected behavior Highly reduce the number of calls to Imagify API users/me overall. Ideally, as explained here, we should perform calls to the API only when really needed (bulk & settings pages, or when hovering the Imagify admin bar) and combine this with some caching for a short amount of time (as already done). If this is not possible, other alternatives can be considered such as a longer cache time but providing a refresh button. See the discussion here
Acceptance Criteria The main acceptance criteria is that the number of calls to the Imagify App must be reduced overall. Exact ACs will depend on the approach selected (request only when needed or longer cache + refresh).
For "request only when needed":
For "longer cach + refresh".