Hi Parin,

Currently Geode only supports cache miss on a region key (primary key). So
there is no way doing it directly in Geode.

I think application could perform following steps to achieve your goals.
Q1:
select a from /Employee a where a.ssn = 'testssn' from Geode, if query
returns null, application needs to query the backend database, find
the employeeId
and then do a get for the employeeId in Geode to load the data.

Q2:
Almost certain you need to query from backend database (if geode only cache
partial data) and use getAll of all employeeId to load any missing entries
into Geode.

Regards,
Eric

On Thu, Aug 10, 2017 at 3:54 AM, Parin dazz <parindazz...@gmail.com> wrote:

> Hello Folks,
>
> I have some requirements on CacheLoader for cache miss events.
>
> From the geode docs,
> The loader is called on *cache misses during get operations*, and it
> populates the cache with the new entry value in addition to returning the
> value to the calling thread.
>
> *Region*
> Employee [Type = Replicated , Primary Key = employeeId]
>
> *Indexes**:*
> Employee.employeeId
> Employee.ssn
>
> *Notes*:
> I have only 100K employees as preloaded in cache initially. [Assume I have
> a purpose not to load everything just to save memory]
>
>
> *Case1:*
>
> User fires a query say,
> select a from /Employee a where a.ssn = 'testssn'
>
> *Q1: *
> Is it possible to load employee based on *ssn* parameter if it's missing
> in cache? [SSN is unique for Employee -- So 1 entry exists in database]
>
>
> *Case2: [I know this does not match to purpose of cache loader, but any
> suggestion to achieve same by any means ?]*
> User fires a query say,
> select a from /Employee a where a.salary > 100000
>
> *Q2:*
> Is it possible to load employee based on salary parameter if it's missing
> in cache? [Such queries should bring all employees with salary > 100K from
> database]
>
> Thanks,
> Parin
>
>

Reply via email to