couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hahn <m...@hahnca.com>
Subject new rev number on update?
Date Mon, 11 Feb 2013 17:30:28 GMT
I've implemented a memory-based cache in front of couch and in my app i'm
getting a 2x performance boost.   (That's enough bragging for now.)

I'd like for the cache to always have the same version of the doc that's in
the DB.  I'm doing this with one exception.  I can't figure out how to have
my update handle return the new _rev along with the rest of the doc.
 Creating new docs and watching changes both give me the correct new rev.

I've solved this for my purposes by storing the sequence number from the
beginning of the _ver and then incrementing it in the doc returned from the
update handler.  This allows me to match docs exactly with that seq number
but it does mean that I usually don't have the real _ver in the docs
floating around.

I use my update handler for all updates so not having the _ver doesn't
matter.  But it does mean that I am locked into the update handler and I
can't use the traditional PUT operation to overwrite the complete doc.

BTW, as I mentioned here recently I'm doing only field updates, including
nested fields, and I'm loving it.  Three sections of code can write at once
without conflicts as long as they are writing to separate fields.  (Ok so I
did need to brag some more.)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message