Does resaving a design document clear its cache? I'm wondering if this is necessary, could you just run lines 70-76 to save the design document no matter what? Then you'd only have one request at max and couch would handle whether or not it needs changing.