Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different store to cache strategies #51

Closed
vicmosin opened this issue May 2, 2016 · 6 comments
Closed

Different store to cache strategies #51

vicmosin opened this issue May 2, 2016 · 6 comments

Comments

@vicmosin
Copy link

vicmosin commented May 2, 2016

I noticed that every call the cache being updated. Maybe it make sense to introduce different strategies of storing cache? For example, we use Etag as a cache mechanism so it's really useless to update cache everytime server responses with 304

@Kevinrob
Copy link
Owner

Kevinrob commented May 2, 2016

Hi, I see what you mean. But this will break the RFC.

[...] the cache MUST:
[...]
   o  use other header fields provided in the 304 (Not Modified)
      response to replace all instances of the corresponding header
      fields in the stored response.

http://tools.ietf.org/html/rfc7234#section-4.3.4

I understand, that a server can (by the way of a 304) replace one or more headers in the cached response. So, it's not "really useless" in general.

Maybe, we can do a different method in CacheStrategyInterface like update(RequestInterface $request, ResponseInterface $response). With that, you can extend the strategy and change the behavior of this method.

Is it a performance issue for you?

@vicmosin
Copy link
Author

vicmosin commented May 2, 2016

Yes, additional method will help as well.

@vicmosin
Copy link
Author

vicmosin commented May 2, 2016

In my case Etag = md5(content) so it is really meaningless to update the cache per each request.. Frontend is a WP site, so yes, it's a performance issue for me ))

@Kevinrob
Copy link
Owner

Kevinrob commented May 2, 2016

Ok, I will try to look at this today or tomorrow. Thank for reporting this issue!

@Kevinrob
Copy link
Owner

Kevinrob commented May 3, 2016

@vicmosin Can you check #52? Is it useful for you like that?

Kevinrob added a commit that referenced this issue May 3, 2016
Add CacheStrategyInterface::update() for #51
@Kevinrob
Copy link
Owner

Kevinrob commented May 3, 2016

Fixed with v1.3.

@Kevinrob Kevinrob closed this as completed May 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants