         articleView.render res, locals, (err) ->
           if err then throw new Error 500
 
-    # Setup RSS feed route
+    # RSS feed
     app.get '/feed.xml', (req, res, next) ->
       exports.cache.ready ->
         articles = []

  constructor: ->
    @readyEmitter = new events.EventEmitter()
    @readyEmitter.once 'ready', () -> true # temp. fix for node issue #792
    @readyEmitter.emit 'ready'
    @readyEmitter.setMaxListeners 0

  build: (articlesDir, encoding) ->

        res.writeHead 200, 'content-type': 'text/xml'
        res.end haml.render(feed, options)

    # Rebuild cache
    app.get '/cache-rebuild/' + configs.rebuildSecret, (req, res, next) ->
      exports.cache.build configs.articlesDir, configs.encoding || "utf8"
      res.writeHead 200, 'content-type': 'text/html'
      res.end 'OK'

###
Cache object used by the controller
###

class Cache
  @cache = null
  @lastBuildArticlesDir = null
  @lastBuildEncoding = null

  getListing: (page = 1, perPage = 10, startDate = null, endDate = null) ->
    if !@ready() then return []
