{"action":"created","comment":{"url":"https://api.github.com/repos/Masterminds/semver/pulls/comments/58917050","id":58917050,"diff_hunk":"@@ -19,6 +19,10 @@ var (\n \tErrInvalidSemVer = errors.New(\"Invalid Semantic Version\")\n )\n \n+// Controls whether or not parsed constraints are cached\n+var cacheVersions = true","path":"version.go","position":5,"original_position":5,"commit_id":"8c22df9dca8e23000f6cc9678ebd34e9a3137eb0","original_commit_id":"8c22df9dca8e23000f6cc9678ebd34e9a3137eb0","user":{"login":"mattfarina","id":62991,"avatar_url":"https://avatars.githubusercontent.com/u/62991?v=3","gravatar_id":"","url":"https://api.github.com/users/mattfarina","html_url":"https://github.com/mattfarina","followers_url":"https://api.github.com/users/mattfarina/followers","following_url":"https://api.github.com/users/mattfarina/following{/other_user}","gists_url":"https://api.github.com/users/mattfarina/gists{/gist_id}","starred_url":"https://api.github.com/users/mattfarina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattfarina/subscriptions","organizations_url":"https://api.github.com/users/mattfarina/orgs","repos_url":"https://api.github.com/users/mattfarina/repos","events_url":"https://api.github.com/users/mattfarina/events{/privacy}","received_events_url":"https://api.github.com/users/mattfarina/received_events","type":"User","site_admin":false},"body":"Why is caching enabled by default and cannot be turned off? Something other than Glide (that is short lived) like a server could easily have a cache that grows quite large causing memory issues. Any thoughts on handling this?","created_at":"2016-04-07T18:02:26Z","updated_at":"2016-04-07T18:02:26Z","html_url":"https://github.com/Masterminds/semver/pull/7#discussion_r58917050","pull_request_url":"https://api.github.com/repos/Masterminds/semver/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/Masterminds/semver/pulls/comments/58917050"},"html":{"href":"https://github.com/Masterminds/semver/pull/7#discussion_r58917050"},"pull_request":{"href":"https://api.github.com/repos/Masterminds/semver/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/Masterminds/semver/pulls/7","id":64042788,"html_url":"https://github.com/Masterminds/semver/pull/7","diff_url":"https://github.com/Masterminds/semver/pull/7.diff","patch_url":"https://github.com/Masterminds/semver/pull/7.patch","issue_url":"https://api.github.com/repos/Masterminds/semver/issues/7","number":7,"state":"open","locked":false,"title":"Refactor to readily allow constraint intersections and unions","user":{"login":"sdboyer","id":21599,"avatar_url":"https://avatars.githubusercontent.com/u/21599?v=3","gravatar_id":"","url":"https://api.github.com/users/sdboyer","html_url":"https://github.com/sdboyer","followers_url":"https://api.github.com/users/sdboyer/followers","following_url":"https://api.github.com/users/sdboyer/following{/other_user}","gists_url":"https://api.github.com/users/sdboyer/gists{/gist_id}","starred_url":"https://api.github.com/users/sdboyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdboyer/subscriptions","organizations_url":"https://api.github.com/users/sdboyer/orgs","repos_url":"https://api.github.com/users/sdboyer/repos","events_url":"https://api.github.com/users/sdboyer/events{/privacy}","received_events_url":"https://api.github.com/users/sdboyer/received_events","type":"User","site_admin":false},"body":"This completely refactors the constraint side of the library (with a few changes to the version side) in order to support set-type operations on constraints.\r\n\r\nHighlights:\r\n\r\n* The `Constraints` type is replaced by a `Constraint` interface (only implementable within the package), which is implemented by `Version` itself for discrete version constraints, `rangeConstraint` for contiguous sets, and `unionConstraint` for disjoint sets of ranges or discrete versions. There's also magic implementations (`any`, `none`) that represent the empty and infinite sets. `NewConstraint` now returns an instance of this `Constraint` interface, plus the same `error` on parse issues.\r\n* Assorted `Intersection()` and `Union()`-type functions and methods are introduced that perform, at high speed (loosely in the 300ns - 2μs range), the relevant set operation on any type of `Constraint`. There are no (intentional) gotchas or edge cases - if it's a valid set operation, the functions should return the correct answer.\r\n* A caching/memoize-y layer for constraint and version parsing. It's quite simple (just a map for each), but being that versions and constraints are almost always <100 byte, it'd take tens of thousands to even crack 1MB, and it improves creation speeds from ~5μs to ~30ns. And, since these all behave as immutable value objects...\r\n* Some other helper methods, such as `AdmitsAny()`, that assist with the sort of operations that a [solver](https://github.com/sdboyer/vsolver) needs.\r\n\r\nOverall, the library is as a whole is both faster and more powerful. Yay! However, this will definitely require a major version bump.","created_at":"2016-03-24T14:38:22Z","updated_at":"2016-04-07T18:02:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d28fa52638ea13e1b823dd9455485afff9082a9a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Masterminds/semver/pulls/7/commits","review_comments_url":"https://api.github.com/repos/Masterminds/semver/pulls/7/comments","review_comment_url":"https://api.github.com/repos/Masterminds/semver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Masterminds/semver/issues/7/comments","statuses_url":"https://api.github.com/repos/Masterminds/semver/statuses/8c22df9dca8e23000f6cc9678ebd34e9a3137eb0","head":{"label":"sdboyer:constraints","ref":"constraints","sha":"8c22df9dca8e23000f6cc9678ebd34e9a3137eb0","user":{"login":"sdboyer","id":21599,"avatar_url":"https://avatars.githubusercontent.com/u/21599?v=3","gravatar_id":"","url":"https://api.github.com/users/sdboyer","html_url":"https://github.com/sdboyer","followers_url":"https://api.github.com/users/sdboyer/followers","following_url":"https://api.github.com/users/sdboyer/following{/other_user}","gists_url":"https://api.github.com/users/sdboyer/gists{/gist_id}","starred_url":"https://api.github.com/users/sdboyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdboyer/subscriptions","organizations_url":"https://api.github.com/users/sdboyer/orgs","repos_url":"https://api.github.com/users/sdboyer/repos","events_url":"https://api.github.com/users/sdboyer/events{/privacy}","received_events_url":"https://api.github.com/users/sdboyer/received_events","type":"User","site_admin":false},"repo":{"id":54603330,"name":"semver","full_name":"sdboyer/semver","owner":{"login":"sdboyer","id":21599,"avatar_url":"https://avatars.githubusercontent.com/u/21599?v=3","gravatar_id":"","url":"https://api.github.com/users/sdboyer","html_url":"https://github.com/sdboyer","followers_url":"https://api.github.com/users/sdboyer/followers","following_url":"https://api.github.com/users/sdboyer/following{/other_user}","gists_url":"https://api.github.com/users/sdboyer/gists{/gist_id}","starred_url":"https://api.github.com/users/sdboyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdboyer/subscriptions","organizations_url":"https://api.github.com/users/sdboyer/orgs","repos_url":"https://api.github.com/users/sdboyer/repos","events_url":"https://api.github.com/users/sdboyer/events{/privacy}","received_events_url":"https://api.github.com/users/sdboyer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sdboyer/semver","description":"Work with Semantic Versions in Go","fork":true,"url":"https://api.github.com/repos/sdboyer/semver","forks_url":"https://api.github.com/repos/sdboyer/semver/forks","keys_url":"https://api.github.com/repos/sdboyer/semver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sdboyer/semver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sdboyer/semver/teams","hooks_url":"https://api.github.com/repos/sdboyer/semver/hooks","issue_events_url":"https://api.github.com/repos/sdboyer/semver/issues/events{/number}","events_url":"https://api.github.com/repos/sdboyer/semver/events","assignees_url":"https://api.github.com/repos/sdboyer/semver/assignees{/user}","branches_url":"https://api.github.com/repos/sdboyer/semver/branches{/branch}","tags_url":"https://api.github.com/repos/sdboyer/semver/tags","blobs_url":"https://api.github.com/repos/sdboyer/semver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sdboyer/semver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sdboyer/semver/git/refs{/sha}","trees_url":"https://api.github.com/repos/sdboyer/semver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sdboyer/semver/statuses/{sha}","languages_url":"https://api.github.com/repos/sdboyer/semver/languages","stargazers_url":"https://api.github.com/repos/sdboyer/semver/stargazers","contributors_url":"https://api.github.com/repos/sdboyer/semver/contributors","subscribers_url":"https://api.github.com/repos/sdboyer/semver/subscribers","subscription_url":"https://api.github.com/repos/sdboyer/semver/subscription","commits_url":"https://api.github.com/repos/sdboyer/semver/commits{/sha}","git_commits_url":"https://api.github.com/repos/sdboyer/semver/git/commits{/sha}","comments_url":"https://api.github.com/repos/sdboyer/semver/comments{/number}","issue_comment_url":"https://api.github.com/repos/sdboyer/semver/issues/comments{/number}","contents_url":"https://api.github.com/repos/sdboyer/semver/contents/{+path}","compare_url":"https://api.github.com/repos/sdboyer/semver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sdboyer/semver/merges","archive_url":"https://api.github.com/repos/sdboyer/semver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sdboyer/semver/downloads","issues_url":"https://api.github.com/repos/sdboyer/semver/issues{/number}","pulls_url":"https://api.github.com/repos/sdboyer/semver/pulls{/number}","milestones_url":"https://api.github.com/repos/sdboyer/semver/milestones{/number}","notifications_url":"https://api.github.com/repos/sdboyer/semver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sdboyer/semver/labels{/name}","releases_url":"https://api.github.com/repos/sdboyer/semver/releases{/id}","deployments_url":"https://api.github.com/repos/sdboyer/semver/deployments","created_at":"2016-03-24T00:50:22Z","updated_at":"2016-03-24T00:50:23Z","pushed_at":"2016-04-07T02:28:37Z","git_url":"git://github.com/sdboyer/semver.git","ssh_url":"git@github.com:sdboyer/semver.git","clone_url":"https://github.com/sdboyer/semver.git","svn_url":"https://github.com/sdboyer/semver","homepage":"","size":130,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Masterminds:master","ref":"master","sha":"7e56b5cd00f9666fc899aa9c11c9a7d51f2a9995","user":{"login":"Masterminds","id":689082,"avatar_url":"https://avatars.githubusercontent.com/u/689082?v=3","gravatar_id":"","url":"https://api.github.com/users/Masterminds","html_url":"https://github.com/Masterminds","followers_url":"https://api.github.com/users/Masterminds/followers","following_url":"https://api.github.com/users/Masterminds/following{/other_user}","gists_url":"https://api.github.com/users/Masterminds/gists{/gist_id}","starred_url":"https://api.github.com/users/Masterminds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Masterminds/subscriptions","organizations_url":"https://api.github.com/users/Masterminds/orgs","repos_url":"https://api.github.com/users/Masterminds/repos","events_url":"https://api.github.com/users/Masterminds/events{/privacy}","received_events_url":"https://api.github.com/users/Masterminds/received_events","type":"Organization","site_admin":false},"repo":{"id":43896280,"name":"semver","full_name":"Masterminds/semver","owner":{"login":"Masterminds","id":689082,"avatar_url":"https://avatars.githubusercontent.com/u/689082?v=3","gravatar_id":"","url":"https://api.github.com/users/Masterminds","html_url":"https://github.com/Masterminds","followers_url":"https://api.github.com/users/Masterminds/followers","following_url":"https://api.github.com/users/Masterminds/following{/other_user}","gists_url":"https://api.github.com/users/Masterminds/gists{/gist_id}","starred_url":"https://api.github.com/users/Masterminds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Masterminds/subscriptions","organizations_url":"https://api.github.com/users/Masterminds/orgs","repos_url":"https://api.github.com/users/Masterminds/repos","events_url":"https://api.github.com/users/Masterminds/events{/privacy}","received_events_url":"https://api.github.com/users/Masterminds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Masterminds/semver","description":"Work with Semantic Versions in Go","fork":false,"url":"https://api.github.com/repos/Masterminds/semver","forks_url":"https://api.github.com/repos/Masterminds/semver/forks","keys_url":"https://api.github.com/repos/Masterminds/semver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Masterminds/semver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Masterminds/semver/teams","hooks_url":"https://api.github.com/repos/Masterminds/semver/hooks","issue_events_url":"https://api.github.com/repos/Masterminds/semver/issues/events{/number}","events_url":"https://api.github.com/repos/Masterminds/semver/events","assignees_url":"https://api.github.com/repos/Masterminds/semver/assignees{/user}","branches_url":"https://api.github.com/repos/Masterminds/semver/branches{/branch}","tags_url":"https://api.github.com/repos/Masterminds/semver/tags","blobs_url":"https://api.github.com/repos/Masterminds/semver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Masterminds/semver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Masterminds/semver/git/refs{/sha}","trees_url":"https://api.github.com/repos/Masterminds/semver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Masterminds/semver/statuses/{sha}","languages_url":"https://api.github.com/repos/Masterminds/semver/languages","stargazers_url":"https://api.github.com/repos/Masterminds/semver/stargazers","contributors_url":"https://api.github.com/repos/Masterminds/semver/contributors","subscribers_url":"https://api.github.com/repos/Masterminds/semver/subscribers","subscription_url":"https://api.github.com/repos/Masterminds/semver/subscription","commits_url":"https://api.github.com/repos/Masterminds/semver/commits{/sha}","git_commits_url":"https://api.github.com/repos/Masterminds/semver/git/commits{/sha}","comments_url":"https://api.github.com/repos/Masterminds/semver/comments{/number}","issue_comment_url":"https://api.github.com/repos/Masterminds/semver/issues/comments{/number}","contents_url":"https://api.github.com/repos/Masterminds/semver/contents/{+path}","compare_url":"https://api.github.com/repos/Masterminds/semver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Masterminds/semver/merges","archive_url":"https://api.github.com/repos/Masterminds/semver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Masterminds/semver/downloads","issues_url":"https://api.github.com/repos/Masterminds/semver/issues{/number}","pulls_url":"https://api.github.com/repos/Masterminds/semver/pulls{/number}","milestones_url":"https://api.github.com/repos/Masterminds/semver/milestones{/number}","notifications_url":"https://api.github.com/repos/Masterminds/semver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Masterminds/semver/labels{/name}","releases_url":"https://api.github.com/repos/Masterminds/semver/releases{/id}","deployments_url":"https://api.github.com/repos/Masterminds/semver/deployments","created_at":"2015-10-08T14:57:25Z","updated_at":"2016-04-07T07:48:51Z","pushed_at":"2016-04-07T02:28:38Z","git_url":"git://github.com/Masterminds/semver.git","ssh_url":"git@github.com:Masterminds/semver.git","clone_url":"https://github.com/Masterminds/semver.git","svn_url":"https://github.com/Masterminds/semver","homepage":"","size":76,"stargazers_count":66,"watchers_count":66,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":66,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Masterminds/semver/pulls/7"},"html":{"href":"https://github.com/Masterminds/semver/pull/7"},"issue":{"href":"https://api.github.com/repos/Masterminds/semver/issues/7"},"comments":{"href":"https://api.github.com/repos/Masterminds/semver/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/Masterminds/semver/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/Masterminds/semver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Masterminds/semver/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/Masterminds/semver/statuses/8c22df9dca8e23000f6cc9678ebd34e9a3137eb0"}}}}