nl_tokens: Cache implementation for CouchDB
pl_tokens: function CouchDBCache ( options ) { var self = this ; options = options || { } ; this . expireAfterSeconds = options . expireAfterSeconds || 60 ; this . connection = Promise . resolve ( ) . then ( function ( ) { return options . auth ? this . auth ( options . auth . username , options . auth . password ) : null ; } ) . then ( function ( <mask> ) { return nano ( { url : options . url || ( options . protocol + '://' + options . host + ':' + options . port ) , cookie : cookie } ) ; } ) ; // create database if it doesn't exist this . db = this . connection . then ( function ( connection ) { var dbName = options . db || 'openamagent' ; return Promise . promisify ( connection . db . create . bind ( connection . db ) ) ( dbName ) . catch ( function ( ) { // ignore } ) . then ( function ( ) { return connection . use ( dbName ) ; } ) ; } ) ; }