KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been thinking about batch reads and writes in a RESTful environment, and I think I've come to the realization that I have broader questions about HTTP caching. (Below I use commas (",") to delimit multiple record IDs, but that detail is not particular to the discussion.) I started with this problem: 1. Single GET invalidated by batch update GET /farms/123 # get info about Old MacDonald's Farm PUT /farms/123,234,345 # update info on Old MacDonald's Farm and some others GET /farms/123 How does a caching server in between the client and the Farms server know to invalidate its cache of /farms/123 when it sees the PUT ? Then I realized this was also a problem: 2. Batch GET invalidated by single (or batch) update GET /farms/123,234,345 # get info about a few farms PUT /farms/123 # update Old MacDonald's Farm GET /farms/123,234,345 How does the cache know to invalidate the multiple-farm GET when it sees the PUT go by? So I figured that the problem was really just with batch operations. Then I realized that any relationship could cause a similar problem. Let's say a farm has zero or one owners, and an owner can have zero or one farms. 3. Single GET invalidated by update to a related record GET /farms/123 # get info about Old MacDonald's Farm PUT /farmers/987 # Old MacDonald sells his farm and buys another one GET /farms/123 How does the cache know to invalidate the single GET when it sees the PUT go by? Even if you change the models to be more RESTful, using relationship models, you get the same problem: GET /farms/123 # get info about Old MacDonald's Farm DELETE /farm_ownerships/456 # Old MacDonald sells his farm... POST /farm_ownerships # and buys another one GET /farms
Tags (comma-separated)
Save Edits
Cancel