{
    "href": "/post/2016/12/28/adr-and-cache-validation/",
    "relId": "2016/12/28/adr-and-cache-validation",
    "title": "ADR with HTTP Caching",
    "author": "pmjones",
    "markup": "html",
    "tags": [
        {
            "href": "/tag/adr/",
            "relId": "adr",
            "title": "Action Domain Responder",
            "author": null,
            "created": "2020-08-17 21:07:42 UTC",
            "updated": [
                "2020-08-17 21:07:42 UTC",
                "2020-09-22 15:41:16 UTC",
                "2020-10-14 18:20:29 UTC",
                "2020-10-14 18:36:31 UTC",
                "2020-10-14 18:36:53 UTC",
                "2020-10-14 18:37:08 UTC",
                "2020-10-14 18:37:48 UTC",
                "2020-10-14 18:39:26 UTC",
                "2020-10-14 19:03:17 UTC",
                "2020-10-14 19:03:35 UTC",
                "2020-10-26 18:12:53 UTC"
            ],
            "markup": "markdown"
        },
        {
            "href": "/tag/programming/",
            "relId": "programming",
            "title": "Programming",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2016-12-28 15:19:51 UTC",
    "updated": [
        "2016-12-28 15:19:51 UTC"
    ],
    "html": "<p>Great conversation with \"MatTheCat\" on Github today, regarding <a href=\"https://github.com/pmjones/adr/issues/44\">HTTP caching headers and the ADR pattern</a>.</p>\n<p>A quick summary:</p>\n<ul>\n<li>You want to return a 304 \"Not Modified\" response if the proper preconditions are met.</li>\n<li>\nYou can only tell if the resource is unmodified if you touch some form of storage.</li>\n<li>In ADR, one rule of thumb is \"if it touches storage, it probably goes in the Domain.\"</li>\n<li>So you need to do all the precondition-checking in the Domain, not in the Action.</li>\n<li>The Domain can return a payload indicating \"not modified\" as appropriate, and the Responder can read that payload status to send back a 304.</li>\n</ul>\n<p>You can read the whole thing <a href=\"https://github.com/pmjones/adr/issues/44\">here</a>. Thanks for the great question Mathieu!</p>\n<p class=\"reddit-links\">Read the Reddit discussion about this post <a href=\"https://www.reddit.com/r/PHP/comments/5kqq24/adr_with_http_caching/\">here</a>.</p>\n"
}
