Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@cacheable in controller actions shouldn't do anything #168

Open
jsolas opened this issue Jan 17, 2023 · 0 comments
Open

@cacheable in controller actions shouldn't do anything #168

jsolas opened this issue Jan 17, 2023 · 0 comments

Comments

@jsolas
Copy link

jsolas commented Jan 17, 2023

As of plugin version 4.0.0, controller caching is no longer supported. However, if the @Cacheable annotation is added to a controller method, the expected behavior should be that the annotation is ignored and the controller action is executed every time. Currently, this does not happen. Instead, the method is executed only the first time as if it were being cached, causing serious problems. If the controller action receives parameters, it always shows the same result, regardless of the parameters passed in subsequent calls.

class ProductsController {

    @Cacheable('show')
    def show (Long id) {
        println "I'm in ${id}"
    }

}

Specific Problem:

  • First Execution: On the first execution, if the method is called with id = 1, it will print "I'm in 1".
  • Subsequent Executions: If the method is called again with id = 2, the action is not executed because the method is already cached, causing an inconsistency in the response. The output will still be "I'm in 1".
@jsolas jsolas changed the title @cacheables in controller actions @cacheable in controller actions shouldn't do anything Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant