Both of these could be implemented as a function, whereby the function implements the logic outlined. The function could execute the desired query and based on the outcome take further action, which could include fetching data from a backing database.
On Thu, Aug 10, 2017 at 9:36 AM, Eric Shu <[email protected]> wrote: > 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 <[email protected]> > 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 >> >> > -- *Mark Secrist | Sr Manager, **Global Education Delivery* [email protected] 970.214.4567 Mobile *pivotal.io <http://www.pivotal.io/>* Follow Us: Twitter <http://www.twitter.com/pivotal> | LinkedIn <http://www.linkedin.com/company/pivotalsoftware> | Facebook <http://www.facebook.com/pivotalsoftware> | YouTube <http://www.youtube.com/gopivotal> | Google+ <https://plus.google.com/105320112436428794490>
