Anahkiasen / flatten

A package to flatten any website to plain HTML
336 stars 42 forks source link

Add timestamp to cached content #8

Closed barryvdh closed 11 years ago

barryvdh commented 11 years ago

Not sure what you think of this, but it could be useful for debugging/checking of the Cache works / is correctly flushed.

Anahkiasen commented 11 years ago

Hm that's something I'd rather have in the .json of cached pages, I prefer to let the actual cached content untouched. Will see what I can do.

Anahkiasen commented 11 years ago

Then again I'm lazy.

barryvdh commented 11 years ago

Maybe this would require a check to see if the response is html, otherwise this could lead to issues with non-html respones (like a GET json request) (Str::startsWith($response->headers->get('Content-Type'), 'text/html'))

Anahkiasen commented 11 years ago

Well the question really is should JSON responses be cached ?

barryvdh commented 11 years ago

Why not? It depends on what you want to output, but a GET request should not modify anything and just return the same thing when called again, unless something has changed. I.e. loading the latest messages for a user, loading portfolio items, showing an RSS feed (XML instead of JSON), calculating some values based on GET params etc.