WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#16624 closed feature request (wontfix)

Cache for WP_HTTP

Reported by: akshay_raje Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: HTTP API Keywords:
Focuses: Cc:

Description

WP_HTTP should have a cache class (either file based or mysql) just like class-feed.php

Change History (4)

comment:1 mikeschinkel3 years ago

  • Cc mikeschinkel@… added

comment:2 dd323 years ago

  • Keywords close added

IMO, This should be left to plugins to handle. Specifically, if a plugin requests a document, it needs to parse it and then cache the result somehow.

Many uses of WP_HTTP is for data which should not be cached, only the parsed response.

For example, API's in WordPress parse the response and then cache that result. Feeds are requested, parsed, and then cached. File downloads shouldn't be cached, etc.

Caching the whole result when a plugin only needs a small segment is also just going to end up caching more than is needed.

Of course, there will be plugins which require the entire document to be cached, but they're in a minority compared to most uses of the API IMO.

comment:3 hakre3 years ago

If we can define an interface for WP_HTTP it should be easy to create a cached transport.

I don't think the idea is that bad at all and would be a good base a plugin could build upon.

comment:4 sivel3 years ago

  • Keywords 2nd-opinion needs-patch close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I don't see any reason why the HTTP API in it's current form would not allow plugin authors to perform caching. We already have a 'pre_http_request' filter that was added for use cases such as caching. I am in agreement with dd32 here, and as such I am closing this ticket.

Note: See TracTickets for help on using tickets.