Skip to content

Instantly share code, notes, and snippets.

@boutell
Created December 21, 2018 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boutell/c4a1b4abda4a19572428b11d0a8babc8 to your computer and use it in GitHub Desktop.
Save boutell/c4a1b4abda4a19572428b11d0a8babc8 to your computer and use it in GitHub Desktop.
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