Closed
Conversation
Adds a CachedClient decorator over Client – it understands HTTP cache
headers in the response and writes / reads data to a local file cache.
A few questions still need to be answered:
* How to handle redirects? Client does that internally at the moment.
Ideas:
* Internalize cache logic into the Client class
* Expose a hook / callback / other extension point from the Client
class
* fetch() is a method on the client class. A decorator means another
layer of fetch(). Maybe that's fine, but maybe fetch($client,
$request) could be a separate function?
* Would there be any upside to handling http cache in a read stream
instead?
adamziel
commented
May 22, 2025
|
|
||
| private function key( string $url ): string { return sha1( $url ); } | ||
|
|
||
| public function body_path( string $url ): string { |
Contributor
Author
There was a problem hiding this comment.
TODO: Either deal with paths or streams, but not both.
Contributor
Author
|
Superseded by #18 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a CachedClient decorator over Client – it understands HTTP cache headers in the response and writes / reads data to a local file cache.
A few questions still need to be answered: