{"action":"created","issue":{"url":"https://api.github.com/repos/tamershahin/grails-redis-flexible-cache/issues/2","labels_url":"https://api.github.com/repos/tamershahin/grails-redis-flexible-cache/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/tamershahin/grails-redis-flexible-cache/issues/2/comments","events_url":"https://api.github.com/repos/tamershahin/grails-redis-flexible-cache/issues/2/events","html_url":"https://github.com/tamershahin/grails-redis-flexible-cache/issues/2","id":56241630,"number":2,"title":"Not working for Controllers","user":{"login":"EduardoSolanas","id":1742835,"avatar_url":"https://avatars.githubusercontent.com/u/1742835?v=3","gravatar_id":"","url":"https://api.github.com/users/EduardoSolanas","html_url":"https://github.com/EduardoSolanas","followers_url":"https://api.github.com/users/EduardoSolanas/followers","following_url":"https://api.github.com/users/EduardoSolanas/following{/other_user}","gists_url":"https://api.github.com/users/EduardoSolanas/gists{/gist_id}","starred_url":"https://api.github.com/users/EduardoSolanas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EduardoSolanas/subscriptions","organizations_url":"https://api.github.com/users/EduardoSolanas/orgs","repos_url":"https://api.github.com/users/EduardoSolanas/repos","events_url":"https://api.github.com/users/EduardoSolanas/events{/privacy}","received_events_url":"https://api.github.com/users/EduardoSolanas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-02T14:17:15Z","updated_at":"2015-02-02T21:48:33Z","closed_at":null,"body":"I have tried this simple example Controller action:\r\n\r\n  @RedisFlexibleCache(key = 'bookservice:test1', expire = '60',reAttachToSession = false)\r\n    def test1() {\r\n\r\n        def content = [title: 'title1', items: [[title: 't'],[title: 't']]]\r\n\r\n        println \"entering here new\"\r\n        render content as JSON\r\n    }\r\n\r\nand it is not working, it is connecting to the database because when I call the service directly inside the action and it saves stuff."},"comment":{"url":"https://api.github.com/repos/tamershahin/grails-redis-flexible-cache/issues/comments/72545062","html_url":"https://github.com/tamershahin/grails-redis-flexible-cache/issues/2#issuecomment-72545062","issue_url":"https://api.github.com/repos/tamershahin/grails-redis-flexible-cache/issues/2","id":72545062,"user":{"login":"EduardoSolanas","id":1742835,"avatar_url":"https://avatars.githubusercontent.com/u/1742835?v=3","gravatar_id":"","url":"https://api.github.com/users/EduardoSolanas","html_url":"https://github.com/EduardoSolanas","followers_url":"https://api.github.com/users/EduardoSolanas/followers","following_url":"https://api.github.com/users/EduardoSolanas/following{/other_user}","gists_url":"https://api.github.com/users/EduardoSolanas/gists{/gist_id}","starred_url":"https://api.github.com/users/EduardoSolanas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EduardoSolanas/subscriptions","organizations_url":"https://api.github.com/users/EduardoSolanas/orgs","repos_url":"https://api.github.com/users/EduardoSolanas/repos","events_url":"https://api.github.com/users/EduardoSolanas/events{/privacy}","received_events_url":"https://api.github.com/users/EduardoSolanas/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T21:48:33Z","updated_at":"2015-02-02T21:48:33Z","body":"Hi thanks for the prompt response, the problem we have now is that all our\r\nlegacy apps uses the @cache annotation  it would be a massive refactoring\r\nmuch more complex than changing the annotations.\r\n\r\nProbably we will extend the redis-cache plugin adding a TTL solution like\r\nyours, so we would just need to change the buildconfig file without\r\nchanging our code.\r\n\r\nThanks anyway,\r\nEduardo\r\nOn 2 Feb 2015 21:13, \"Tamer\" <notifications@github.com> wrote:\r\n\r\n> Hi Eduardo,\r\n>\r\n> As suggested here:\r\n> https://github.com/tamershahin/grails-redis-flexible-cache#controllersservices-dynamic-methods\r\n> , I recommend you to don't use annotation on whole controller actions,\r\n> since they are much more instrumented that you can see.\r\n>\r\n> your method should look like this:\r\n>\r\n> def test1() {\r\n> def content = redisFlexibleCache group: 'longLasting', key: 'key:1',\r\n> reAttachToSession: true, {\r\n> [title: 'title1', items: [[title: 't'],[title: 't']]]\r\n> println \"entering here new\"\r\n> }\r\n>\r\n> render content as JSON\r\n>\r\n> }\r\n>\r\n> or use the annotation around a service method and render its return value.\r\n>\r\n> The inner complexity of controller action is the first reason, the second\r\n> one (and more important to us when we developed the plugin) is to allow\r\n> much more granularity on what to keep and evict. For bigger result you may\r\n> want to evict only subsets, and forcing the developer to act at action\r\n> level will prevent this to happen.\r\n>\r\n> —\r\n> Reply to this email directly or view it on GitHub\r\n> <https://github.com/tamershahin/grails-redis-flexible-cache/issues/2#issuecomment-72539017>\r\n> .\r\n>"}}