I have a custom realm plugin implemented to which I want to add caching until a certain time period and invalidate the cache. There is a CachingRealm interface which I can implement for the cache eviction APIs.
I was looking at the example in the link below and I see that there is a different cache realm type defined and it's extending the custom realm, doing some cache lookups/insertion and calling the super custom realm methods. I feel like this is some kind of duplication and could have the custom realm class itself implement the CachingRealm and have the logic there. Is there any specific reason it's done this way in the example? Also, why is the caching type not mapped in the .yml file?
Also, wanted to confirm if elastic is adding some kind of built-in caching for custom realm types like it does for some configured realms, I presume it's not.