{"action":"created","comment":{"url":"https://api.github.com/repos/prebid/prebid-server/pulls/comments/157523967","pull_request_review_id":84179938,"id":157523967,"diff_hunk":"@@ -5,28 +5,63 @@ import (\n \t\"database/sql\"\n \t\"encoding/json\"\n \t\"fmt\"\n+\n \t\"github.com/golang/glog\"\n+\t\"github.com/prebid/prebid-server/stored_requests/cache/cacher\"\n )\n \n // dbFetcher fetches Stored Requests from a database. This should be instantiated through the NewPostgres() function.\n type dbFetcher struct {\n \tdb         *sql.DB\n \tqueryMaker func(int) (string, error)\n+\tcache      cacher.Cacher","path":"stored_requests/backends/db_fetcher/fetcher.go","position":13,"original_position":13,"commit_id":"943f7d6b27c3458f1e82dbcc538fffc1bcc6c78d","original_commit_id":"943f7d6b27c3458f1e82dbcc538fffc1bcc6c78d","user":{"login":"dbemiller","id":27972385,"avatar_url":"https://avatars2.githubusercontent.com/u/27972385?v=4","gravatar_id":"","url":"https://api.github.com/users/dbemiller","html_url":"https://github.com/dbemiller","followers_url":"https://api.github.com/users/dbemiller/followers","following_url":"https://api.github.com/users/dbemiller/following{/other_user}","gists_url":"https://api.github.com/users/dbemiller/gists{/gist_id}","starred_url":"https://api.github.com/users/dbemiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbemiller/subscriptions","organizations_url":"https://api.github.com/users/dbemiller/orgs","repos_url":"https://api.github.com/users/dbemiller/repos","events_url":"https://api.github.com/users/dbemiller/events{/privacy}","received_events_url":"https://api.github.com/users/dbemiller/received_events","type":"User","site_admin":false},"body":"> How would it look if there are multiple cache layers?\r\n\r\nI was imagining something like this:\r\n\r\n```\r\nfunc makeFetcher(cfg *config.Configuration) (fetcher Fetcher) {\r\n  fetcher = makeBaseFetcher(cfg.fetcher.base)\r\n  for _, cacheConfig := cfg.fetcher.cacheLayers {\r\n    fetcher = AddCache(makeCacher(cacheConfig, fetcher)\r\n  }\r\n  return\r\n}\r\n\r\nfunc makeCacher(cfg *config.CacheConfig) Cacher {\r\n  ttl := cfg.ttl\r\n  if isMemory(cfg) {\r\n    return &inmemorycache.Cache{\r\n      ttl: cfg.ttl,\r\n    }\r\n  } else if isRedis(cfg.ttl) ...\r\n}\r\n```\r\n\r\nThis uses a pretty crappy config setup... but gets the general idea across.\r\n\r\n> Would one first layer have a shorter TTL than the second cache?\r\n\r\nIn practice... maybe? Probably? That'd be up to whoever is hosting PBS. Each type of cache would have its own configuration options... so I assume they'd use either TTLs, or max capacities, or things like that to optimize for their hardware.","created_at":"2017-12-18T15:58:50Z","updated_at":"2017-12-18T15:58:50Z","html_url":"https://github.com/prebid/prebid-server/pull/262#discussion_r157523967","pull_request_url":"https://api.github.com/repos/prebid/prebid-server/pulls/262","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/prebid/prebid-server/pulls/comments/157523967"},"html":{"href":"https://github.com/prebid/prebid-server/pull/262#discussion_r157523967"},"pull_request":{"href":"https://api.github.com/repos/prebid/prebid-server/pulls/262"}},"in_reply_to_id":157494465},"pull_request":{"url":"https://api.github.com/repos/prebid/prebid-server/pulls/262","id":158282519,"html_url":"https://github.com/prebid/prebid-server/pull/262","diff_url":"https://github.com/prebid/prebid-server/pull/262.diff","patch_url":"https://github.com/prebid/prebid-server/pull/262.patch","issue_url":"https://api.github.com/repos/prebid/prebid-server/issues/262","number":262,"state":"open","locked":false,"title":"Issue 249","user":{"login":"abramovic","id":981933,"avatar_url":"https://avatars2.githubusercontent.com/u/981933?v=4","gravatar_id":"","url":"https://api.github.com/users/abramovic","html_url":"https://github.com/abramovic","followers_url":"https://api.github.com/users/abramovic/followers","following_url":"https://api.github.com/users/abramovic/following{/other_user}","gists_url":"https://api.github.com/users/abramovic/gists{/gist_id}","starred_url":"https://api.github.com/users/abramovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abramovic/subscriptions","organizations_url":"https://api.github.com/users/abramovic/orgs","repos_url":"https://api.github.com/users/abramovic/repos","events_url":"https://api.github.com/users/abramovic/events{/privacy}","received_events_url":"https://api.github.com/users/abramovic/received_events","type":"User","site_admin":false},"body":"Hey, I saw this open issue and wanted to try to take a stab at it\r\nhttps://github.com/prebid/prebid-server/issues/249\r\n\r\nLMK if this is a direction that you’d like to go and I’m happy to\r\ncontinue cranking :)","created_at":"2017-12-14T07:05:27Z","updated_at":"2017-12-18T15:58:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42decb79a89f722434b6f1d357a84aa15ef35ede","assignee":null,"assignees":[],"requested_reviewers":[{"login":"cindyhere33","id":11478095,"avatar_url":"https://avatars1.githubusercontent.com/u/11478095?v=4","gravatar_id":"","url":"https://api.github.com/users/cindyhere33","html_url":"https://github.com/cindyhere33","followers_url":"https://api.github.com/users/cindyhere33/followers","following_url":"https://api.github.com/users/cindyhere33/following{/other_user}","gists_url":"https://api.github.com/users/cindyhere33/gists{/gist_id}","starred_url":"https://api.github.com/users/cindyhere33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cindyhere33/subscriptions","organizations_url":"https://api.github.com/users/cindyhere33/orgs","repos_url":"https://api.github.com/users/cindyhere33/repos","events_url":"https://api.github.com/users/cindyhere33/events{/privacy}","received_events_url":"https://api.github.com/users/cindyhere33/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/prebid/prebid-server/pulls/262/commits","review_comments_url":"https://api.github.com/repos/prebid/prebid-server/pulls/262/comments","review_comment_url":"https://api.github.com/repos/prebid/prebid-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prebid/prebid-server/issues/262/comments","statuses_url":"https://api.github.com/repos/prebid/prebid-server/statuses/943f7d6b27c3458f1e82dbcc538fffc1bcc6c78d","head":{"label":"abramovic:249","ref":"249","sha":"943f7d6b27c3458f1e82dbcc538fffc1bcc6c78d","user":{"login":"abramovic","id":981933,"avatar_url":"https://avatars2.githubusercontent.com/u/981933?v=4","gravatar_id":"","url":"https://api.github.com/users/abramovic","html_url":"https://github.com/abramovic","followers_url":"https://api.github.com/users/abramovic/followers","following_url":"https://api.github.com/users/abramovic/following{/other_user}","gists_url":"https://api.github.com/users/abramovic/gists{/gist_id}","starred_url":"https://api.github.com/users/abramovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abramovic/subscriptions","organizations_url":"https://api.github.com/users/abramovic/orgs","repos_url":"https://api.github.com/users/abramovic/repos","events_url":"https://api.github.com/users/abramovic/events{/privacy}","received_events_url":"https://api.github.com/users/abramovic/received_events","type":"User","site_admin":false},"repo":{"id":91499002,"name":"prebid-server","full_name":"abramovic/prebid-server","owner":{"login":"abramovic","id":981933,"avatar_url":"https://avatars2.githubusercontent.com/u/981933?v=4","gravatar_id":"","url":"https://api.github.com/users/abramovic","html_url":"https://github.com/abramovic","followers_url":"https://api.github.com/users/abramovic/followers","following_url":"https://api.github.com/users/abramovic/following{/other_user}","gists_url":"https://api.github.com/users/abramovic/gists{/gist_id}","starred_url":"https://api.github.com/users/abramovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abramovic/subscriptions","organizations_url":"https://api.github.com/users/abramovic/orgs","repos_url":"https://api.github.com/users/abramovic/repos","events_url":"https://api.github.com/users/abramovic/events{/privacy}","received_events_url":"https://api.github.com/users/abramovic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abramovic/prebid-server","description":"Server side component to offload prebid processing to the cloud","fork":true,"url":"https://api.github.com/repos/abramovic/prebid-server","forks_url":"https://api.github.com/repos/abramovic/prebid-server/forks","keys_url":"https://api.github.com/repos/abramovic/prebid-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abramovic/prebid-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abramovic/prebid-server/teams","hooks_url":"https://api.github.com/repos/abramovic/prebid-server/hooks","issue_events_url":"https://api.github.com/repos/abramovic/prebid-server/issues/events{/number}","events_url":"https://api.github.com/repos/abramovic/prebid-server/events","assignees_url":"https://api.github.com/repos/abramovic/prebid-server/assignees{/user}","branches_url":"https://api.github.com/repos/abramovic/prebid-server/branches{/branch}","tags_url":"https://api.github.com/repos/abramovic/prebid-server/tags","blobs_url":"https://api.github.com/repos/abramovic/prebid-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abramovic/prebid-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abramovic/prebid-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/abramovic/prebid-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abramovic/prebid-server/statuses/{sha}","languages_url":"https://api.github.com/repos/abramovic/prebid-server/languages","stargazers_url":"https://api.github.com/repos/abramovic/prebid-server/stargazers","contributors_url":"https://api.github.com/repos/abramovic/prebid-server/contributors","subscribers_url":"https://api.github.com/repos/abramovic/prebid-server/subscribers","subscription_url":"https://api.github.com/repos/abramovic/prebid-server/subscription","commits_url":"https://api.github.com/repos/abramovic/prebid-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/abramovic/prebid-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/abramovic/prebid-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/abramovic/prebid-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/abramovic/prebid-server/contents/{+path}","compare_url":"https://api.github.com/repos/abramovic/prebid-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abramovic/prebid-server/merges","archive_url":"https://api.github.com/repos/abramovic/prebid-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abramovic/prebid-server/downloads","issues_url":"https://api.github.com/repos/abramovic/prebid-server/issues{/number}","pulls_url":"https://api.github.com/repos/abramovic/prebid-server/pulls{/number}","milestones_url":"https://api.github.com/repos/abramovic/prebid-server/milestones{/number}","notifications_url":"https://api.github.com/repos/abramovic/prebid-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abramovic/prebid-server/labels{/name}","releases_url":"https://api.github.com/repos/abramovic/prebid-server/releases{/id}","deployments_url":"https://api.github.com/repos/abramovic/prebid-server/deployments","created_at":"2017-05-16T19:59:37Z","updated_at":"2017-05-24T01:53:33Z","pushed_at":"2017-12-14T15:06:24Z","git_url":"git://github.com/abramovic/prebid-server.git","ssh_url":"git@github.com:abramovic/prebid-server.git","clone_url":"https://github.com/abramovic/prebid-server.git","svn_url":"https://github.com/abramovic/prebid-server","homepage":null,"size":767,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"prebid:master","ref":"master","sha":"53630e89a775b64376b6ddd83b107dea0d9bc67d","user":{"login":"prebid","id":13242760,"avatar_url":"https://avatars1.githubusercontent.com/u/13242760?v=4","gravatar_id":"","url":"https://api.github.com/users/prebid","html_url":"https://github.com/prebid","followers_url":"https://api.github.com/users/prebid/followers","following_url":"https://api.github.com/users/prebid/following{/other_user}","gists_url":"https://api.github.com/users/prebid/gists{/gist_id}","starred_url":"https://api.github.com/users/prebid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prebid/subscriptions","organizations_url":"https://api.github.com/users/prebid/orgs","repos_url":"https://api.github.com/users/prebid/repos","events_url":"https://api.github.com/users/prebid/events{/privacy}","received_events_url":"https://api.github.com/users/prebid/received_events","type":"Organization","site_admin":false},"repo":{"id":88511474,"name":"prebid-server","full_name":"prebid/prebid-server","owner":{"login":"prebid","id":13242760,"avatar_url":"https://avatars1.githubusercontent.com/u/13242760?v=4","gravatar_id":"","url":"https://api.github.com/users/prebid","html_url":"https://github.com/prebid","followers_url":"https://api.github.com/users/prebid/followers","following_url":"https://api.github.com/users/prebid/following{/other_user}","gists_url":"https://api.github.com/users/prebid/gists{/gist_id}","starred_url":"https://api.github.com/users/prebid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prebid/subscriptions","organizations_url":"https://api.github.com/users/prebid/orgs","repos_url":"https://api.github.com/users/prebid/repos","events_url":"https://api.github.com/users/prebid/events{/privacy}","received_events_url":"https://api.github.com/users/prebid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prebid/prebid-server","description":"Server side component to offload prebid processing to the cloud","fork":false,"url":"https://api.github.com/repos/prebid/prebid-server","forks_url":"https://api.github.com/repos/prebid/prebid-server/forks","keys_url":"https://api.github.com/repos/prebid/prebid-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prebid/prebid-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prebid/prebid-server/teams","hooks_url":"https://api.github.com/repos/prebid/prebid-server/hooks","issue_events_url":"https://api.github.com/repos/prebid/prebid-server/issues/events{/number}","events_url":"https://api.github.com/repos/prebid/prebid-server/events","assignees_url":"https://api.github.com/repos/prebid/prebid-server/assignees{/user}","branches_url":"https://api.github.com/repos/prebid/prebid-server/branches{/branch}","tags_url":"https://api.github.com/repos/prebid/prebid-server/tags","blobs_url":"https://api.github.com/repos/prebid/prebid-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prebid/prebid-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prebid/prebid-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/prebid/prebid-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prebid/prebid-server/statuses/{sha}","languages_url":"https://api.github.com/repos/prebid/prebid-server/languages","stargazers_url":"https://api.github.com/repos/prebid/prebid-server/stargazers","contributors_url":"https://api.github.com/repos/prebid/prebid-server/contributors","subscribers_url":"https://api.github.com/repos/prebid/prebid-server/subscribers","subscription_url":"https://api.github.com/repos/prebid/prebid-server/subscription","commits_url":"https://api.github.com/repos/prebid/prebid-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/prebid/prebid-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/prebid/prebid-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/prebid/prebid-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/prebid/prebid-server/contents/{+path}","compare_url":"https://api.github.com/repos/prebid/prebid-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prebid/prebid-server/merges","archive_url":"https://api.github.com/repos/prebid/prebid-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prebid/prebid-server/downloads","issues_url":"https://api.github.com/repos/prebid/prebid-server/issues{/number}","pulls_url":"https://api.github.com/repos/prebid/prebid-server/pulls{/number}","milestones_url":"https://api.github.com/repos/prebid/prebid-server/milestones{/number}","notifications_url":"https://api.github.com/repos/prebid/prebid-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prebid/prebid-server/labels{/name}","releases_url":"https://api.github.com/repos/prebid/prebid-server/releases{/id}","deployments_url":"https://api.github.com/repos/prebid/prebid-server/deployments","created_at":"2017-04-17T13:38:32Z","updated_at":"2017-12-08T17:04:18Z","pushed_at":"2017-12-18T07:09:59Z","git_url":"git://github.com/prebid/prebid-server.git","ssh_url":"git@github.com:prebid/prebid-server.git","clone_url":"https://github.com/prebid/prebid-server.git","svn_url":"https://github.com/prebid/prebid-server","homepage":null,"size":745,"stargazers_count":50,"watchers_count":50,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"archived":false,"open_issues_count":42,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":34,"open_issues":42,"watchers":50,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prebid/prebid-server/pulls/262"},"html":{"href":"https://github.com/prebid/prebid-server/pull/262"},"issue":{"href":"https://api.github.com/repos/prebid/prebid-server/issues/262"},"comments":{"href":"https://api.github.com/repos/prebid/prebid-server/issues/262/comments"},"review_comments":{"href":"https://api.github.com/repos/prebid/prebid-server/pulls/262/comments"},"review_comment":{"href":"https://api.github.com/repos/prebid/prebid-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prebid/prebid-server/pulls/262/commits"},"statuses":{"href":"https://api.github.com/repos/prebid/prebid-server/statuses/943f7d6b27c3458f1e82dbcc538fffc1bcc6c78d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dbemiller"}}