grails-cache
grails-cache copied to clipboard
@cacheable in controller actions shouldn't do anything
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"
.