3

Say I have a class Person with a name field. I can do a Person.findByName but what if I want to override this method to ensure that the query is cached? How do I override this dynamic finder method?

Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121
Champ
  • 1,291
  • 4
  • 16
  • 32

1 Answers1

2

You can simply write:

Person.findByName("some-name", [cache: true])
Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121
  • Yes, I am aware of that. But what I want is to change 'Person.findByName("some-name")' so that it is cacheable query by default. Don't want a coder to remember to add ', [cache: true]' wherever the dynamic finder is used. – Champ Feb 05 '15 at 05:53