 middleware = (options) ->
 
   # Start the Python mobwrite daemon.
-  debug = options?.debug?
+  debug = options?.debug is true
+  cache = options?.cache is true
   logger = options?.logger
   daemonPort = options?.port or DEFAULT_DAEMON_PORT
   daemonHost = options?.host or DEFAULT_DAEMON_HOST

    }).call(this);
    """

MOBWRITE_MINIFIED_JAVASCRIPT = """
    ;(function(){
      #{fs.readFileSync(path.resolve(MOBWRITE_PATH, "html/compressed_form.js"))};
    }).call(this);

    syncInterval: options?.minSyncInterval or DEFAULT_MIN_SYNC_INTERVAL
    minSyncInterval: options?.minSyncInterval or DEFAULT_MIN_SYNC_INTERVAL
    maxSyncInterval: options?.maxSyncInterval or DEFAULT_MAX_SYNC_INTERVAL
  getClientJavascript = ->
    return """
      ;(function(){
        #{if debug then getMobwriteDebugJavascript() else getMobwriteMinifiedJavascript()}
        var options = JSON.parse(#{JSON.stringify(JSON.stringify(clientOptions))})
        for (var key in options) {
          if (options.hasOwnProperty(key)) {
            mobwrite[key] = options[key]
          }
        }
      }).call(this);
      """
  clientJavascriptCache = getClientJavascript()

  # Create a connect middleware (e.g. for use in ExpressJS).
  # TODO: verify that this works with plain http.createServer()
