GitHub PullRequestReviewCommentEvent at 2014-03-28 17:37:50
Repository: uber-cache-helpers
Actor: Natim
Payload: {"comment":{"url":"https://api.github.com/repos/mozilla-services/uber-cache-helpers/pulls/comments/11076693","id":11076693,"diff_hunk":"@@ -0,0 +1,39 @@\n+/* This Source Code Form is subject to the terms of the Mozilla Public\n+ * License, v. 2.0. If a copy of the MPL was not distributed with this\n+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n+\"use strict\";\n+\n+var uberCache = require('uber-cache');\n+\n+var engines = {\n+  memory: \"uber-cache/lib/memory-engine\",\n+  mongodb: \"./proxies/mongodb\",\n+  redis: \"uber-cache-redis\",\n+  memcached: \"uber-cache-memcached\"\n+}\n+\n+\n+function getCacheBackend(options) {\n+  if (!options.hasOwnProperty(\"engine\")) {\n+    throw new Error(\"You must to specify the engine.\");\n+  }\n+\n+  var enginesAvailable = Object.keys(engines);\n+  if (enginesAvailable.indexOf(options.engine) === -1) {\n+    throw new Error(\"We don't know this \" + options.engine +\n+                    \" backend. Should be one of: \" + enginesAvailable);\n+  }\n+\n+  var DatabaseBackend = require(engines[options.engine])\n+\n+  try {\n+    var engine = DatabaseBackend(options.settings || {});\n+  } catch (err) {\n+    throw new Error(\"You need to install '\" + options.engine +\n+                    \"' dependencies: \" + err);\n+  }\n+\n+  return uberCache({engine: engine});\n+}\n+\n+module.exports = getCacheBackend;","path":"cache-backend.js","position":39,"original_position":39,"commit_id":"31974cde0aa1311652a935a9187468d2dcc8519e","original_commit_id":"31974cde0aa1311652a935a9187468d2dcc8519e","user":{"login":"Natim","id":229453,"avatar_url":"https://avatars.githubusercontent.com/u/229453?","gravatar_id":"48e87ebebf7bee2a0ca10aa2362795a6","url":"https://api.github.com/users/Natim","html_url":"https://github.com/Natim","followers_url":"https://api.github.com/users/Natim/followers","following_url":"https://api.github.com/users/Natim/following{/other_user}","gists_url":"https://api.github.com/users/Natim/gists{/gist_id}","starred_url":"https://api.github.com/users/Natim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Natim/subscriptions","organizations_url":"https://api.github.com/users/Natim/orgs","repos_url":"https://api.github.com/users/Natim/repos","events_url":"https://api.github.com/users/Natim/events{/privacy}","received_events_url":"https://api.github.com/users/Natim/received_events","type":"User","site_admin":false},"body":"or getUberCacheBackend?","created_at":"2014-03-28T17:37:50Z","updated_at":"2014-03-28T17:37:50Z","html_url":"https://github.com/mozilla-services/uber-cache-helpers/pull/1#discussion_r11076693","pull_request_url":"https://api.github.com/repos/mozilla-services/uber-cache-helpers/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/uber-cache-helpers/pulls/comments/11076693"},"html":{"href":"https://github.com/mozilla-services/uber-cache-helpers/pull/1#discussion_r11076693"},"pull_request":{"href":"https://api.github.com/repos/mozilla-services/uber-cache-helpers/pulls/1"}}}}