Relation between CacheStore<K,V> and IgniteCache<K,V>

classic Classic list List threaded Threaded
5 messages Options
Kobe Kobe
Reply | Threaded
Open this post in threaded view
|

Relation between CacheStore<K,V> and IgniteCache<K,V>


Hello...

I am trying to understand how CacheStore behaviour is inserted into IgniteCache.
I see in the Javadoc of IgniteCache that the loadCache() method passes optional arguments
to CacheStore.loadCache(). I do not understand this correlation.

Please explain?

/Kobe
Denis Magda Denis Magda
Reply | Threaded
Open this post in threaded view
|

Re: Relation between CacheStore<K,V> and IgniteCache<K,V>

Hi Kobe,

CacheStore is set for every IgniteCache using CacheConfiguration.setCacheStoreFactory(...) method as it's shown in this example [1].

IgniteCache.loadCache(...) parameters can be used to control a subset of data that should be loaded from an underlying persistent storage into a cache.

Also I would recommend to take a look at examples that showcase how the store works in practice [2]


On Sat, Mar 12, 2016 at 10:05 AM, Kobe <[hidden email]> wrote:

Hello...

I am trying to understand how CacheStore behaviour is inserted into
IgniteCache.
I see in the Javadoc of IgniteCache that the loadCache() method passes
optional arguments
to CacheStore.loadCache(). I do not understand this correlation.

Please explain?

/Kobe



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Relation-between-CacheStore-K-V-and-IgniteCache-K-V-tp3471.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Kobe Kobe
Reply | Threaded
Open this post in threaded view
|

Re: Relation between CacheStore<K,V> and IgniteCache<K,V>

Denis,

I need to cache a collection of objects of different types (a collection of campuses <Long, Campus>, collection of <Long, Building>, and a collection of residents
<Long, Resident>). Does this mean I have instantiate three distinct  caches
          IgniteCache<Long, Campus>,
          IgniteCache<Long, Building>
and     Ignite<Long, Resident>

and attach corresponding CacheStore entities? How would a SQL join across these entities work?
Also, I am using HibernateSessionListener to populate these caches. Is there any gotcha I should be
aware of wrt it?

thanx,

/Kobe

Denis Magda wrote
Hi Kobe,

CacheStore is set for every IgniteCache using
CacheConfiguration.setCacheStoreFactory(...) method as it's shown in this
example [1].

IgniteCache.loadCache(...) parameters can be used to control a subset of
data that should be loaded from an underlying persistent storage into a
cache.

Also I would recommend to take a look at examples that showcase how the
store works in practice [2]

[1] https://apacheignite.readme.io/docs/persistent-store#cachestore-example
[2]
https://github.com/apache/ignite/tree/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store

On Sat, Mar 12, 2016 at 10:05 AM, Kobe <[hidden email]> wrote:

>
> Hello...
>
> I am trying to understand how CacheStore behaviour is inserted into
> IgniteCache.
> I see in the Javadoc of IgniteCache that the loadCache() method passes
> optional arguments
> to CacheStore.loadCache(). I do not understand this correlation.
>
> Please explain?
>
> /Kobe
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Relation-between-CacheStore-K-V-and-IgniteCache-K-V-tp3471.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>
Kobe Kobe
Reply | Threaded
Open this post in threaded view
|

Re: Relation between CacheStore<K,V> and IgniteCache<K,V>

Could anyone please confirm my understanding? That is, if I need to cache distinct entities (attached to the same hibernate session), I must create distinct IgniteCache instances?

Regards,

Kobe

Kobe wrote
Denis,

I need to cache a collection of objects of different types (a collection of campuses <Long, Campus>, collection of <Long, Building>, and a collection of residents
<Long, Resident>). Does this mean I have instantiate three distinct  caches
          IgniteCache<Long, Campus>,
          IgniteCache<Long, Building>
and     Ignite<Long, Resident>

and attach corresponding CacheStore entities? How would a SQL join across these entities work?
Also, I am using HibernateSessionListener to populate these caches. Is there any gotcha I should be
aware of wrt it?

thanx,

/Kobe

Denis Magda wrote
Hi Kobe,

CacheStore is set for every IgniteCache using
CacheConfiguration.setCacheStoreFactory(...) method as it's shown in this
example [1].

IgniteCache.loadCache(...) parameters can be used to control a subset of
data that should be loaded from an underlying persistent storage into a
cache.

Also I would recommend to take a look at examples that showcase how the
store works in practice [2]

[1] https://apacheignite.readme.io/docs/persistent-store#cachestore-example
[2]
https://github.com/apache/ignite/tree/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store

On Sat, Mar 12, 2016 at 10:05 AM, Kobe <[hidden email]> wrote:

>
> Hello...
>
> I am trying to understand how CacheStore behaviour is inserted into
> IgniteCache.
> I see in the Javadoc of IgniteCache that the loadCache() method passes
> optional arguments
> to CacheStore.loadCache(). I do not understand this correlation.
>
> Please explain?
>
> /Kobe
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Relation-between-CacheStore-K-V-and-IgniteCache-K-V-tp3471.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>
Denis Magda Denis Magda
Reply | Threaded
Open this post in threaded view
|

Re: Relation between CacheStore<K,V> and IgniteCache<K,V>

In reply to this post by Kobe
Kobe,

Your understanding looks correct to me. It's always better to decouple
different entities from each other and store them in relevant caches.
Here you can follow the same rules as when you work with a database
where you create a table for each unique entity.

For every cache you have to set a CacheStore explicitly in its
configuration.
SQL joins work out of the box in Ignite [1]. However you should properly
collocate data to use joins when partitioned caches participate in a
query [2]

Have nothing to add in relation to HibernateSessionListener.

[1] https://apacheignite.readme.io/docs/sql-queries#cross-cache-queries
[2] https://apacheignite.readme.io/docs/affinity-collocation

--
Denis

On 3/13/2016 2:12 AM, Kobe wrote:

> Denis,
>
> I need to cache a collection of objects of different types (a collection of
> campuses <Long, Campus>, collection of <Long, Building>, and a collection of
> residents
> <Long, Resident>). Does this mean I have instantiate three distinct  caches
>            IgniteCache<Long, Campus>,
>            IgniteCache<Long, Building>
> and     Ignite<Long, Resident>
>
> and attach corresponding CacheStore entities? How would a SQL join across
> these entities work?
> Also, I am using HibernateSessionListener to populate these caches. Is there
> any gotcha I should be
> aware of wrt it?
>
> thanx,
>
> /Kobe
>
>
> Denis Magda wrote
>> Hi Kobe,
>>
>> CacheStore is set for every IgniteCache using
>> CacheConfiguration.setCacheStoreFactory(...) method as it's shown in this
>> example [1].
>>
>> IgniteCache.loadCache(...) parameters can be used to control a subset of
>> data that should be loaded from an underlying persistent storage into a
>> cache.
>>
>> Also I would recommend to take a look at examples that showcase how the
>> store works in practice [2]
>>
>> [1]
>> https://apacheignite.readme.io/docs/persistent-store#cachestore-example
>> [2]
>> https://github.com/apache/ignite/tree/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store
>>
>> On Sat, Mar 12, 2016 at 10:05 AM, Kobe &lt;
>> rk_@
>> &gt; wrote:
>>
>>> Hello...
>>>
>>> I am trying to understand how CacheStore behaviour is inserted into
>>> IgniteCache.
>>> I see in the Javadoc of IgniteCache that the loadCache() method passes
>>> optional arguments
>>> to CacheStore.loadCache(). I do not understand this correlation.
>>>
>>> Please explain?
>>>
>>> /Kobe
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://apache-ignite-users.70518.x6.nabble.com/Relation-between-CacheStore-K-V-and-IgniteCache-K-V-tp3471.html
>>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>>>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Relation-between-CacheStore-K-V-and-IgniteCache-K-V-tp3471p3474.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.