Hi Roman,
I missed asking these ones earlier about the cache configuration part in
the mybatis-ignite page @ http://www.mybatis.org/ignite-cache/, if you know
please share some light,
1. What is the significance of setting the "templateCacheCfg" bean in the
ignite cache config xml... what are the properties that i can configure? I
ask this because i have set this by specifying some config but it doesn't
seem to be picked up or related to the Mapper caches that i see getting
created based on my cache specification in my mapper xmls. What is the
relation between the two? Can i configure details of the different mapper
caches in this templateCacheCfg?. Meaning can i configure things like the
key & value details, etc?
2. When i connect to the Mapper caches by doing a
ignite.cache(<mapper-cache-name>) (eg:
ignite.cache("com.brocade.dcm.domain.mapper.DeptMapper")) & look at the key
& value types, they are shown to be plain java.lang.Objects and not the
actual keys & values (which in the case of 'Dept' example would be Integer
& com.brocade.dcm.domain.model.Dept respectively.).
I am beginning to understand that objects are cached in some other
serialized form & does not rely on the actual objects or their equals &
hashCode. Is this understanding correct? If so would it be possible at all
to directly access the ignite cache & get the cached DTOs?
I was trying to see if i can join two caches & provide a view type cache in
ignite itself..would this be possible at all?
Below is the code snippet i used to investigate the cache,
IgniteCache cache =
ignite.cache("com.brocade.dcm.domain.mapper.DeptMapper");
CacheMetricsMXBean cacheMetricsMXBean = cache.localMxBean();
CacheMetrics cacheMetrics = cache.localMetrics();
System.out.println("KEY TYPE : cacheMetricsMXBean : " +
cacheMetricsMXBean.getKeyType());
System.out.println("VALUE TYPE : cacheMetricsMXBean : " +
cacheMetricsMXBean.getValueType());
System.out.println("KEY TYPE : cacheMetrics : " +
cacheMetrics.getKeyType());
System.out.println("VALUE TYPE : cacheMetrics : " +
cacheMetrics.getValueType());
Output:
KEY TYPE : cacheMetricsMXBean : java.lang.Object
VALUE TYPE : cacheMetricsMXBean : java.lang.Object
KEY TYPE : cacheMetrics : java.lang.Object
VALUE TYPE : cacheMetrics : java.lang.Object
Regards,
Muthu
On Mon, Jun 5, 2017 at 7:44 PM, Muthu <[email protected]> wrote:
> Hi Roman,
>
> For 1 & 2, i checked that doc earlier but was frankly confused about the
> mention of flushing the entire cache for an insert or update (or delete for
> that matter) or the non-availability of caching support for
> these...wouldn't it make sense to insert or update the cache for the
> entries inserted or updated?
>
> For 3, I haven't tried using the default MyBatis L2 cache...i can try if
> that also has the same behavior.
>
> Regards,
> Muthu
>
> On Mon, Jun 5, 2017 at 7:06 PM, Roman Shtykh <[email protected]> wrote:
>
>> Muthu,
>>
>> For 1 & 2, have you checked [1]? I think it is not related to Ignite L2
>> integration. Please see the cache section.
>>
>> For 3, have you checked if it happens with the default L2 cache?
>>
>> [1] http://www.mybatis.org/mybatis-3/sqlmap-xml.html
>>
>>
>> -- Roman
>>
>> On Tuesday, June 6, 2017 9:06 AM, mlekshma <[email protected]>
>> wrote:
>>
>>
>> Hi Folks,
>>
>> I see the following issues when using mybatis-ignite. Wondering if any one
>> else faced & solved these issues or if i am missing something as these
>> seem
>> very difficult to work around,
>>
>> 1. Eviction or flushing of all entries on insert : Basically whenever i
>> call
>> a mapper.insert operation all current entries in the cache get flushed. I
>> guess i can set the flushCache to false and in the code follow up the
>> insert
>> with a get by that id to make sure it gets cached..but i am wondering if
>> this is something that can be fixed or if i am doing something wrong.
>>
>> 2. No caching on insert : As mentioned earlier, in addition to flushing of
>> all entries the entry being inserted with mapper.insert is also not
>> getting
>> cached by default which again can be worked around by the above method.
>>
>> 3. No caching when using selectByExample (to select based on a condition
>> or
>> to select all entries) & select by a CustomCriteria (using Criteria
>> Object)
>> : Basically when using mapper.selectByExample instead of
>> selectByPrimaryKey
>> or when selecting with a custom criteria object, the fetched entities
>> don't
>> get cached. I am not sure how i can work around this issue. This is also a
>> bit of a problem since on app restarts we will need the cache to be loaded
>> with all entries in the DB table by virtue of doing a
>> mapper.selectByExample.
>>
>> Thanks
>> Muthu
>>
>>
>>
>> --
>> View this message in context: http://apache-ignite-users.705
>> 18.x6.nabble.com/MyBatis-Ignite-L2-cache-Integration-issues-tp13391.html
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>>
>>
>>
>