GitHub PullRequestReviewCommentEvent at 2015-01-01 18:17:12
Repository: jtwig/jtwig
Actor: lyncodev
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/jtwig/jtwig/pulls/comments/22400950","id":22400950,"diff_hunk":"@@ -0,0 +1,64 @@\n+/**\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.jtwig.cache;\n+\n+import org.jtwig.content.model.Template;\n+\n+/**\n+ * A TemplateCache implementation is used at compile/render time to store and\n+ * retrieve previously-compiled templates in order to avoid re-compiling them\n+ * repeatedly.\n+ */\n+public interface TemplateCache {\n+    /**\n+     * Caches the given parsed template so that it can be retrieved again later.\n+     * @param name The name or identifier of the template\n+     * @param template The template to store\n+     * @return The cache instance\n+     */\n+    TemplateCache addParsed(String name, Template template);\n+    /**\n+     * Retrieves the parsed template indicated by the provided name.\n+     * @param name The name or identifier of the template\n+     * @return The template requested, or null if not found\n+     */\n+    Template getParsed(String name);\n+    /**\n+     * Removes the parsed template indicated by the provided name.\n+     * @param name The name or identifier of the template\n+     * @return The removed template, or null if not found\n+     */\n+    Template removeParsed(String name);\n+    /**\n+     * Caches the given compiled template so that it can be retrieved again\n+     * later.\n+     * @param name The name or identifier of the template\n+     * @param template The compiled template to store\n+     * @return The cache instance\n+     */\n+    TemplateCache addCompiled(String name, Template.CompiledTemplate template);\n+    /**\n+     * Retrieves the compiled template indicated by the provided name.\n+     * @param name The name or identifier of the template\n+     * @return The compiled template requested, or null if not found\n+     */\n+    Template.CompiledTemplate getCompiled(String name);\n+    /**\n+     * Removes the compiled template indicated by the provided name.\n+     * @param name The name or identifier of the compiled template\n+     * @return The removed compiled template, or null if not found\n+     */\n+    Template.CompiledTemplate removeCompiled(String name);","path":"jtwig-core/src/main/java/org/jtwig/cache/TemplateCache.java","position":63,"original_position":63,"commit_id":"5836ae7cb17d1774c188c7352086361f76eff2ec","original_commit_id":"5836ae7cb17d1774c188c7352086361f76eff2ec","user":{"login":"lyncodev","id":1894870,"avatar_url":"https://avatars.githubusercontent.com/u/1894870?v=3","gravatar_id":"","url":"https://api.github.com/users/lyncodev","html_url":"https://github.com/lyncodev","followers_url":"https://api.github.com/users/lyncodev/followers","following_url":"https://api.github.com/users/lyncodev/following{/other_user}","gists_url":"https://api.github.com/users/lyncodev/gists{/gist_id}","starred_url":"https://api.github.com/users/lyncodev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyncodev/subscriptions","organizations_url":"https://api.github.com/users/lyncodev/orgs","repos_url":"https://api.github.com/users/lyncodev/repos","events_url":"https://api.github.com/users/lyncodev/events{/privacy}","received_events_url":"https://api.github.com/users/lyncodev/received_events","type":"User","site_admin":false},"body":"@thomas-p-wilson can you explain me why we need a remove parsed/compiled?","created_at":"2015-01-01T18:17:12Z","updated_at":"2015-01-01T18:17:12Z","html_url":"https://github.com/jtwig/jtwig/pull/263#discussion_r22400950","pull_request_url":"https://api.github.com/repos/jtwig/jtwig/pulls/263","_links":{"self":{"href":"https://api.github.com/repos/jtwig/jtwig/pulls/comments/22400950"},"html":{"href":"https://github.com/jtwig/jtwig/pull/263#discussion_r22400950"},"pull_request":{"href":"https://api.github.com/repos/jtwig/jtwig/pulls/263"}}},"pull_request":{"url":"https://api.github.com/repos/jtwig/jtwig/pulls/263","id":26691671,"html_url":"https://github.com/jtwig/jtwig/pull/263","diff_url":"https://github.com/jtwig/jtwig/pull/263.diff","patch_url":"https://github.com/jtwig/jtwig/pull/263.patch","issue_url":"https://api.github.com/repos/jtwig/jtwig/issues/263","number":263,"state":"open","locked":false,"title":"Refactor template model","user":{"login":"thomas-p-wilson","id":597691,"avatar_url":"https://avatars.githubusercontent.com/u/597691?v=3","gravatar_id":"","url":"https://api.github.com/users/thomas-p-wilson","html_url":"https://github.com/thomas-p-wilson","followers_url":"https://api.github.com/users/thomas-p-wilson/followers","following_url":"https://api.github.com/users/thomas-p-wilson/following{/other_user}","gists_url":"https://api.github.com/users/thomas-p-wilson/gists{/gist_id}","starred_url":"https://api.github.com/users/thomas-p-wilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomas-p-wilson/subscriptions","organizations_url":"https://api.github.com/users/thomas-p-wilson/orgs","repos_url":"https://api.github.com/users/thomas-p-wilson/repos","events_url":"https://api.github.com/users/thomas-p-wilson/events{/privacy}","received_events_url":"https://api.github.com/users/thomas-p-wilson/received_events","type":"User","site_admin":false},"body":"Some highlights:\r\n\r\n* `RenderConfiguration`, `CompileConfiguration`, and `ParseConfiguration` have been combined into the `Environment`\r\n* The various `Resource` implementations (`StringJtwigResource`, et al) have been refactored into a set of `Loader`s and `Resource`s. The `Environment` is now solely responsible for managing the resolution and loading of resource. Multiple loaders may be specified through the use of the `ChainLoader`. As a result, the resolution process should always return a path relative to an arbitrary resource root, in much the same way as we specify a resource as 'client/list.twig' and whatnot.\r\n* Concurrent rendering demonstrated a hang when the output stream wasn't specified. This is resolved with an exception noting the problem. Helpful in unit tests\r\n* Unit tests have been widely refactored for uniformity, in addition to the refactoring required due to all my other changes.\r\n* Template caching is now supported. At minimum a per-execution cache is required due to the new resolution and loading process, but the cache can be cleared after execution. In my local tests, render time drops considerably on the second run. I've seen a drop in one of my projects from ~1200ms to ~25ms after a second run. TODO: Auto-clear the ExecutionCache after rendering has completed.\r\n* With the existence of the `Template` and its implementations, we now have a place to store per-template information, present examples being `Macro` and `Block` information, for later usage. This also allows us to use the SetVariable tag during template extension.","created_at":"2014-12-30T16:19:49Z","updated_at":"2015-01-01T18:17:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"242cf81c062f924d4dd5875b39d75c41dfffb7f9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jtwig/jtwig/pulls/263/commits","review_comments_url":"https://api.github.com/repos/jtwig/jtwig/pulls/263/comments","review_comment_url":"https://api.github.com/repos/jtwig/jtwig/pulls/comments/{number}","comments_url":"https://api.github.com/repos/jtwig/jtwig/issues/263/comments","statuses_url":"https://api.github.com/repos/jtwig/jtwig/statuses/5836ae7cb17d1774c188c7352086361f76eff2ec","head":{"label":"thomas-p-wilson:refactor-template-model","ref":"refactor-template-model","sha":"5836ae7cb17d1774c188c7352086361f76eff2ec","user":{"login":"thomas-p-wilson","id":597691,"avatar_url":"https://avatars.githubusercontent.com/u/597691?v=3","gravatar_id":"","url":"https://api.github.com/users/thomas-p-wilson","html_url":"https://github.com/thomas-p-wilson","followers_url":"https://api.github.com/users/thomas-p-wilson/followers","following_url":"https://api.github.com/users/thomas-p-wilson/following{/other_user}","gists_url":"https://api.github.com/users/thomas-p-wilson/gists{/gist_id}","starred_url":"https://api.github.com/users/thomas-p-wilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomas-p-wilson/subscriptions","organizations_url":"https://api.github.com/users/thomas-p-wilson/orgs","repos_url":"https://api.github.com/users/thomas-p-wilson/repos","events_url":"https://api.github.com/users/thomas-p-wilson/events{/privacy}","received_events_url":"https://api.github.com/users/thomas-p-wilson/received_events","type":"User","site_admin":false},"repo":{"id":23671731,"name":"jtwig","full_name":"thomas-p-wilson/jtwig","owner":{"login":"thomas-p-wilson","id":597691,"avatar_url":"https://avatars.githubusercontent.com/u/597691?v=3","gravatar_id":"","url":"https://api.github.com/users/thomas-p-wilson","html_url":"https://github.com/thomas-p-wilson","followers_url":"https://api.github.com/users/thomas-p-wilson/followers","following_url":"https://api.github.com/users/thomas-p-wilson/following{/other_user}","gists_url":"https://api.github.com/users/thomas-p-wilson/gists{/gist_id}","starred_url":"https://api.github.com/users/thomas-p-wilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomas-p-wilson/subscriptions","organizations_url":"https://api.github.com/users/thomas-p-wilson/orgs","repos_url":"https://api.github.com/users/thomas-p-wilson/repos","events_url":"https://api.github.com/users/thomas-p-wilson/events{/privacy}","received_events_url":"https://api.github.com/users/thomas-p-wilson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thomas-p-wilson/jtwig","description":"Java modern template engine","fork":true,"url":"https://api.github.com/repos/thomas-p-wilson/jtwig","forks_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/forks","keys_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/teams","hooks_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/hooks","issue_events_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/issues/events{/number}","events_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/events","assignees_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/assignees{/user}","branches_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/branches{/branch}","tags_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/tags","blobs_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/git/refs{/sha}","trees_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/statuses/{sha}","languages_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/languages","stargazers_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/stargazers","contributors_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/contributors","subscribers_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/subscribers","subscription_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/subscription","commits_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/commits{/sha}","git_commits_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/git/commits{/sha}","comments_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/comments{/number}","issue_comment_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/issues/comments/{number}","contents_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/contents/{+path}","compare_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/merges","archive_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/downloads","issues_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/issues{/number}","pulls_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/pulls{/number}","milestones_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/milestones{/number}","notifications_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/labels{/name}","releases_url":"https://api.github.com/repos/thomas-p-wilson/jtwig/releases{/id}","created_at":"2014-09-04T17:14:02Z","updated_at":"2014-12-30T16:06:00Z","pushed_at":"2014-12-30T16:08:41Z","git_url":"git://github.com/thomas-p-wilson/jtwig.git","ssh_url":"git@github.com:thomas-p-wilson/jtwig.git","clone_url":"https://github.com/thomas-p-wilson/jtwig.git","svn_url":"https://github.com/thomas-p-wilson/jtwig","homepage":"http://jtwig.org/","size":2045,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"jtwig:master","ref":"master","sha":"9ccf625352478caa1d2559ae2f0ed2acfa90abce","user":{"login":"jtwig","id":9424415,"avatar_url":"https://avatars.githubusercontent.com/u/9424415?v=3","gravatar_id":"","url":"https://api.github.com/users/jtwig","html_url":"https://github.com/jtwig","followers_url":"https://api.github.com/users/jtwig/followers","following_url":"https://api.github.com/users/jtwig/following{/other_user}","gists_url":"https://api.github.com/users/jtwig/gists{/gist_id}","starred_url":"https://api.github.com/users/jtwig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtwig/subscriptions","organizations_url":"https://api.github.com/users/jtwig/orgs","repos_url":"https://api.github.com/users/jtwig/repos","events_url":"https://api.github.com/users/jtwig/events{/privacy}","received_events_url":"https://api.github.com/users/jtwig/received_events","type":"Organization","site_admin":false},"repo":{"id":5755905,"name":"jtwig","full_name":"jtwig/jtwig","owner":{"login":"jtwig","id":9424415,"avatar_url":"https://avatars.githubusercontent.com/u/9424415?v=3","gravatar_id":"","url":"https://api.github.com/users/jtwig","html_url":"https://github.com/jtwig","followers_url":"https://api.github.com/users/jtwig/followers","following_url":"https://api.github.com/users/jtwig/following{/other_user}","gists_url":"https://api.github.com/users/jtwig/gists{/gist_id}","starred_url":"https://api.github.com/users/jtwig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtwig/subscriptions","organizations_url":"https://api.github.com/users/jtwig/orgs","repos_url":"https://api.github.com/users/jtwig/repos","events_url":"https://api.github.com/users/jtwig/events{/privacy}","received_events_url":"https://api.github.com/users/jtwig/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jtwig/jtwig","description":"Java modern template engine","fork":false,"url":"https://api.github.com/repos/jtwig/jtwig","forks_url":"https://api.github.com/repos/jtwig/jtwig/forks","keys_url":"https://api.github.com/repos/jtwig/jtwig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jtwig/jtwig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jtwig/jtwig/teams","hooks_url":"https://api.github.com/repos/jtwig/jtwig/hooks","issue_events_url":"https://api.github.com/repos/jtwig/jtwig/issues/events{/number}","events_url":"https://api.github.com/repos/jtwig/jtwig/events","assignees_url":"https://api.github.com/repos/jtwig/jtwig/assignees{/user}","branches_url":"https://api.github.com/repos/jtwig/jtwig/branches{/branch}","tags_url":"https://api.github.com/repos/jtwig/jtwig/tags","blobs_url":"https://api.github.com/repos/jtwig/jtwig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jtwig/jtwig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jtwig/jtwig/git/refs{/sha}","trees_url":"https://api.github.com/repos/jtwig/jtwig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jtwig/jtwig/statuses/{sha}","languages_url":"https://api.github.com/repos/jtwig/jtwig/languages","stargazers_url":"https://api.github.com/repos/jtwig/jtwig/stargazers","contributors_url":"https://api.github.com/repos/jtwig/jtwig/contributors","subscribers_url":"https://api.github.com/repos/jtwig/jtwig/subscribers","subscription_url":"https://api.github.com/repos/jtwig/jtwig/subscription","commits_url":"https://api.github.com/repos/jtwig/jtwig/commits{/sha}","git_commits_url":"https://api.github.com/repos/jtwig/jtwig/git/commits{/sha}","comments_url":"https://api.github.com/repos/jtwig/jtwig/comments{/number}","issue_comment_url":"https://api.github.com/repos/jtwig/jtwig/issues/comments/{number}","contents_url":"https://api.github.com/repos/jtwig/jtwig/contents/{+path}","compare_url":"https://api.github.com/repos/jtwig/jtwig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jtwig/jtwig/merges","archive_url":"https://api.github.com/repos/jtwig/jtwig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jtwig/jtwig/downloads","issues_url":"https://api.github.com/repos/jtwig/jtwig/issues{/number}","pulls_url":"https://api.github.com/repos/jtwig/jtwig/pulls{/number}","milestones_url":"https://api.github.com/repos/jtwig/jtwig/milestones{/number}","notifications_url":"https://api.github.com/repos/jtwig/jtwig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jtwig/jtwig/labels{/name}","releases_url":"https://api.github.com/repos/jtwig/jtwig/releases{/id}","created_at":"2012-09-10T21:05:20Z","updated_at":"2014-12-28T11:59:33Z","pushed_at":"2014-12-28T11:59:32Z","git_url":"git://github.com/jtwig/jtwig.git","ssh_url":"git@github.com:jtwig/jtwig.git","clone_url":"https://github.com/jtwig/jtwig.git","svn_url":"https://github.com/jtwig/jtwig","homepage":"http://jtwig.org/","size":3515,"stargazers_count":68,"watchers_count":68,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":21,"forks":20,"open_issues":21,"watchers":68,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jtwig/jtwig/pulls/263"},"html":{"href":"https://github.com/jtwig/jtwig/pull/263"},"issue":{"href":"https://api.github.com/repos/jtwig/jtwig/issues/263"},"comments":{"href":"https://api.github.com/repos/jtwig/jtwig/issues/263/comments"},"review_comments":{"href":"https://api.github.com/repos/jtwig/jtwig/pulls/263/comments"},"review_comment":{"href":"https://api.github.com/repos/jtwig/jtwig/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/jtwig/jtwig/pulls/263/commits"},"statuses":{"href":"https://api.github.com/repos/jtwig/jtwig/statuses/5836ae7cb17d1774c188c7352086361f76eff2ec"}}}}