Make WordPress Core

Opened 9 years ago

Closed 9 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:


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

Change History (4)

#1 @mikeschinkel
9 years ago

  • Cc mikeschinkel@… added

#2 @dd32
9 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.

#3 @hakre
9 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.

#4 @sivel
9 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.