REST application, Transactions, Cache drop

Posted by Julian Davchev on Stack Overflow See other posts from Stack Overflow or by Julian Davchev
Published on 2010-05-14T06:39:10Z Indexed on 2010/05/14 6:44 UTC
Read the original article Hit count: 466

Filed under:
|
|
|

Hi, I am building REST API in php with memcache layer on top for caching all resources. After some reading experience it turns out it's best when documents are as simple as posible...mainly due to dropping cache sequences.

So if there is 'building','room' entities for the 'room' document I would only place the id of the 'building' and not the whole data of it. Then on api client side I would merge data as needed.

Problem becomes when I need to update/insert (most cases more than one table). I update one resource but on second update system fails or whatever and there becomes database inconsistancies.

I see several solutions: 1. Implement rest transactions which I find wrong and complex as idea is to be stateless and easy. 2. On update/insert actions I pass more complex data (not single entities) so I can force transactions on API level. But this will make it weird that your GET document structure is same as PUT document structure. And again somehow make drop sequences complex.

Any pointers are more than welcome. Cheers,

© Stack Overflow or respective owner

Related posts about rest

Related posts about cache