Created
December 21, 2018 13:28
-
-
Save boutell/c4a1b4abda4a19572428b11d0a8babc8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.getCollection = function(callback) { | |
return self.apos.db.collection('aposCache', function(err, collection) { | |
if (err) { | |
return callback(err); | |
} | |
self.cacheCollection = collection; | |
return async.series({ | |
keyIndex: function(callback) { | |
return self.cacheCollection.ensureIndex({ key: 1, cache: 1 }, { unique: true }, callback); | |
}, | |
expireIndex: function(callback) { | |
return self.cacheCollection.ensureIndex({ expires: 1 }, { expireAfterSeconds: 0 }, callback); | |
} | |
}, callback); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment