Is there a way to cache json responses
-
I’m hoping someone here can answer this for me. Is there a way to cache the api’s json responses? I would assume you could use wordpress transients to do this but I’m not sure how to even achieve this. Basically what I’m after is this
1. http call to an endpoint with query params
2. check for transient containing json result for that api call
3. If transient exists, output json (skip all json_prepare_post filters)
4. If transient doesn’t exist, query the database and filter the results like normal.Has anyone achieve this? My api calls take around 0.5 seconds to complete which by my standards is pretty slow. I’m hoping I can use a caching method to speed this up.
- The topic ‘Is there a way to cache json responses’ is closed to new replies.