Update to use new couch_event application
Fix name of event listener callback
Add a simple dialyzer task

This fixes a number of dialyzer warnings as well. Mostly for simple
missing matches. I'm not sure it's worth covering all of these cases
just yet but it wasn't hard for this code.

I've also included the ets_lru module in the dialyzer source to help
ensure that the new match APIs are used correctly. It will skip it
if it's not found on the default path or at ETS_LRU_PATH.
Define a macro for the LRU cache name
Simplify pulling out all design document ids from the cache

This allows the code to avoid copying the entire ets entries into
code from a separate module for both efficiency and modularity
purposes. This requires the new ets_lru match code to function.

It currently uses match which is dispatched to the gen_server.
It might be wise to make it direct since the match code does not
update access times (or if it did, we could make that a cast).
Add support for keying the cache by revision

This patch splits up the code paths between ddoc_cache and
ddoc_cache_opener a bit more clearly, keeping the gen_server
implementation details "mostly" in one place. The overloaded
open function has been replaced with more explicit function
names. I've left the old open to support old code during the
upgrade process but it should be removed after the next release.

The opener lookup keys are a bit mismatched from the LRU keys so
I've renamed those variables to make it clear when we're talking
about the openers rather than the cache itself. It could be
argued that the revision oblivious doc lookup could reuse the
result of any pending revision specific lookup on the same id
but it seems a bit too optimistic here so I've left them as
separate opener keys.
Address code review feedback

Summary:
* removed the useless include inside ddoc_cache
* revised the export listing style and removed confusing comments
* added guards back to older ddoc_cache:open/2 API
* clarified a type declaration, still strict until it's moved
* replaced match_newest sort with the canonical comparison rule
* simplified setting of the OpenerKey in some clauses
* renamed Rev* variables for correctness
* added back precious whitespace in some places
set module version to 1
Load design docs with an ejson body
Update to use couch_stats