 
 	# Database collection
 	database: null  # QueryEngine Collection
+	databaseCache: null
 	getDatabase: -> @database
+	getDatabaseCache: -> @databaseCache or @database
 
 	# Files by URL
 	# Used to speed up fetching

				# Create a colelction for the files to reload
				filesToReload = opts.filesToReload or new FilesCollection()
				# Add anything which was modified since our last generate
				filesToReload.add(database.findAll(mtime: $gte: docpad.lastGenerate).models)

				# Update our generate time
				docpad.lastGenerate = new Date()

				# Perform the reload of the selected files
				docpad.loadFiles {collection:filesToReload}, (err) ->


		# Update generating flag
		docpad.generating = false
		docpad.generateEnded = new Date()

		# Update caches
		docpad.databaseCache = null
		collection.each (file) ->
			for url in file.get('urls')
				docpad.filesByUrl[url] = file.cid

		# Fire plugins
		docpad.emitSync 'generateAfter', server:docpad.getServer(), (err) ->
			return next(err)  if err

			# Log generated
			seconds = (docpad.generateEnded - docpad.generateStarted) / 1000
			howMany =
				if collection is database
					"all #{collection.length}"
