In Grails, I have the following code snippet.
class AutoCompleteController {
def getAutoCompleteData() {
// Open db connection and get the data
// and do other long and heavy computation
jsonString(data: result)
}
}
I want to implement a debounce algorithm for any incoming request if it comes from the same user, the same request data, and the same user's IP address.
I have been looking at implementing debounce in Java However, I don't have any idea how to integrating it with my grails controller.
Please help me how to implement it in grails? I am looking for implementation with java annotation something like this:
class AutoCompleteController {
@Debounce(delay = 1000) // ------------>>>>>> How to implement this annotation?
def getAutoCompleteData() {
// heavy logic
jsonString(data: result)
}
}