Hi Folks,

I have some concerns about CacheLoader.

I know that we attach it with the region definition in server which helps
to load missing entries into cache from database.

But my reason for asking is more from usability point of view. As an
example,

Usually in client/server topology, you write a logic @ client layer to
address business queries from users via rest call and internally contacting
gemfire server using 1 of the following ways,

- QueryService
- FunctionService
- GemfireTemplate
- Repositories
- Direct region level apis [May be not preferable as it does not provide
abstraction as QueryService/FunctionService]

*Case1:*
> *Assuming that I am coding each separate method/api for each unique
business call.*

findStudentById,findStudentByNameAndAge,findStudentWithHomeworkNotCompleted
etc.

Internally each of them is using GemfireTemplate/Region/Repositories to get
the data I need.

>> But does that really make sense to adopt  "method/logic per business
query"?
>> Who likes code change for each such new requirement?
>> It's not even wise to write separate function and deploy jar using
"deploy" function as still that needs new code


*Case2:*
> *How about using QueryService/FunctionService where you define each
unique business query in database/query region/external file/anything*?

For each new business call, I just have to add new query to my database in
form of "findStudentById = "Select * from /Student where id=$1"


Ohh yes it has become super easy now to reach time to market and no change
in code.

Assume that I have a nice generic way to deal with dynamic binding of
parameters and their datatypes.

*But now what's the use of "CacheLoader"? *

*Is it going to work with Gemfire OQL query? May be not as it does not know
if dynamic binding is a "Primary Key" and going to return only 1 value.*

*Please share your thoughts. Do also suggest me if there is better way to
achieve same.*

Thanks,
Parin

Reply via email to