You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by Simone Tripodi <si...@gmail.com> on 2009/11/17 21:23:14 UTC

[iBatis 3] Cache troubles

Hi all guys,
I've been doing some experiment using the last beta of iBatis 3 and
I've the feeling you happily fixed the inglorious IBATIS-555 issue
about the CacheKey unique hashcode generation on different JVMs :)

Now I've been porting my old stuff to the new iBatis implementation
and everything has worked fine until I plugged-in the cache, I really
hope you can help me to understand where I'm wrong: I implemented a
Memcached-based Cache class, wrapping the spy memcached client
(code.google.com/p/spymemcached/), injecting a singleton instance to
the Configuration programmatically using google-guice 2 and finally
referenced in the sql-map via the snippet:

<cache-ref namespace="memcached"/>

What I noticed, reading the logs, is the following:
* when flushing the statements defined in the sql map, is called the
method org.apache.ibatis.cache.Cache#clear(): that makes me a little
worried, because in a memcached context I ideally want to use just one
memcached client instance and reference it in the whole application,
when performing an insert operation I wouldn't flush the whole cache,
but rather remove only the interested statements; since I'm still used
to the old iBatis2 cache model, how can I fix it?
* no data is cached, the method
org.apache.ibatis.cache.Cache#putObject(Object,Object) is never
called;

All the code I've been producing is public, you can find it on
google-code[1], and on the test directory you can find the scenario[2]
I described

Thanks in advance for your help, any kind of suggestion will be very
appreciated!!!
Simone


[1] http://code.google.com/p/ibaguice/source/browse/#svn/trunk
[2] http://code.google.com/p/ibaguice/source/browse/trunk/src/test/java/com/ibaguice/SimpleTestCase.java
-- 
http://www.google.com/profiles/simone.tripodi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ibatis.apache.org
For additional commands, e-mail: dev-help@ibatis.apache.org


Re: [iBatis 3] Cache troubles

Posted by Simone Tripodi <si...@gmail.com>.
Hi all,
do you have any suggestion/hint please? Have a nice Sunday :)
Simone

On Wed, Nov 18, 2009 at 9:08 PM, Simone Tripodi
<si...@gmail.com> wrote:
> Hi Clinton,
> sorry my mail was a little confusing - I took advantage from some
> spare time during the work to reply quickly :P
>
> So, things are that I was able to use memcached in iBATIS 2 but I'm no
> more able to (re)use the same stuff in iBATIS 3 . The "issue" - if I
> can call it like this - is that, since memcached doesn't support
> namespaces, when flushing the cache, I don't know which statements
> I've to  invalidate - in iBATIS2 was quite simple since the group
> helped me a lot - and taking inspiration from what you did with
> OSCache was more simple.
>
> BTW, here[1] you can find the Cache implementation I've been using -
> nothing complicate - that just wraps the memcached client to
> store/retrieve the cached objects. Also in this case, I took
> inspiration from your cache decorator implementations to see how to
> use the Cache interface.
>
> Finally, just to give you a tangible sample of the scenario I speak
> (already reported on the iBATIS Wiki): I realized the REST-services
> layer for this[2] online-radio using iBATIS2 as persistence layer, the
> application is replicated on more than 2 servlet (I had to patch
> iBATIS2 in way to supply the IBATIS-555 issue and notified on the dev
> ML - [3]) container on different servers, using 3 nodes of memcached
> server.
>
> Thanks in advance and thanks for your patience, best regards!!!
> Simone
>
> [1] http://tinyurl.com/yb8vxl4
> [2] http://www.gooomradio.com/
> [3] http://tinyurl.com/ye43gas
>
> On Wed, Nov 18, 2009 at 7:38 PM, Clinton Begin <cl...@gmail.com> wrote:
>> Maybe I don't understand...
>>
>>   * Are you saying that you have this working in iBATIS 2, but can't get it
>> to work with iBATIS 3?
>>
>>   * Or you can't get it to work in either, but understand iB2 better so want
>> it described in those terms?
>>
>> Cheers,
>> Clinton
>>
>> On Wed, Nov 18, 2009 at 2:37 AM, Simone Tripodi <si...@gmail.com>
>> wrote:
>>>
>>> Hi Clinton,
>>> unfortunately the official version of Memcached - the one we've been
>>> using on production for years - doesn't support namespaces/tags, there
>>> is a patched version called Memcached-tags[1] but isn't officially
>>> supported :(
>>> Can you provide me please any idea how to supply this lack? Is there
>>> any way to obtain the cache group, speaking in iBatis2 therms?
>>> Thanks in advance, best regards
>>> Simone
>>>
>>> [1] http://code.google.com/p/memcached-tag/
>>>
>>> On Wed, Nov 18, 2009 at 7:49 AM, Simone Tripodi
>>> <si...@gmail.com> wrote:
>>> > Hi Clinton,
>>> > thanks for your kind reply, I'll let you know ASAP the results of my
>>> > tries if you're interested on :)
>>> > Best regards,
>>> > Simone
>>> >
>>> > On Wed, Nov 18, 2009 at 12:25 AM, Clinton Begin
>>> > <cl...@gmail.com> wrote:
>>> >> I'll try to answer in two short statements to see if that helps.  I
>>> >> won't
>>> >> have time to look through the code anytime soon...
>>> >>
>>> >>   * I think you can solve the first problem of flushing the whole cache
>>> >> by
>>> >> passing the cache's namespace to memcached as a cache domain (I'm not
>>> >> sure
>>> >> what memcached calls them, but essentially flush only a partition or
>>> >> group
>>> >> of the cached elements (OSCache calls this a domain I believe).
>>> >>
>>> >>   * The putObject isn't called until the end of the session, or when
>>> >> commit
>>> >> is called.  It's a transactional cache, so if you rollback a
>>> >> transaction
>>> >> before closing the session or committing... the cache won't be updated
>>> >> with
>>> >> potentially erroneous or inconsistent data.
>>> >>
>>> >> Hope that helps,
>>> >> Clinton
>>> >>
>>> >> On Tue, Nov 17, 2009 at 1:23 PM, Simone Tripodi
>>> >> <si...@gmail.com>
>>> >> wrote:
>>> >>>
>>> >>> Hi all guys,
>>> >>> I've been doing some experiment using the last beta of iBatis 3 and
>>> >>> I've the feeling you happily fixed the inglorious IBATIS-555 issue
>>> >>> about the CacheKey unique hashcode generation on different JVMs :)
>>> >>>
>>> >>> Now I've been porting my old stuff to the new iBatis implementation
>>> >>> and everything has worked fine until I plugged-in the cache, I really
>>> >>> hope you can help me to understand where I'm wrong: I implemented a
>>> >>> Memcached-based Cache class, wrapping the spy memcached client
>>> >>> (code.google.com/p/spymemcached/), injecting a singleton instance to
>>> >>> the Configuration programmatically using google-guice 2 and finally
>>> >>> referenced in the sql-map via the snippet:
>>> >>>
>>> >>> <cache-ref namespace="memcached"/>
>>> >>>
>>> >>> What I noticed, reading the logs, is the following:
>>> >>> * when flushing the statements defined in the sql map, is called the
>>> >>> method org.apache.ibatis.cache.Cache#clear(): that makes me a little
>>> >>> worried, because in a memcached context I ideally want to use just one
>>> >>> memcached client instance and reference it in the whole application,
>>> >>> when performing an insert operation I wouldn't flush the whole cache,
>>> >>> but rather remove only the interested statements; since I'm still used
>>> >>> to the old iBatis2 cache model, how can I fix it?
>>> >>> * no data is cached, the method
>>> >>> org.apache.ibatis.cache.Cache#putObject(Object,Object) is never
>>> >>> called;
>>> >>>
>>> >>> All the code I've been producing is public, you can find it on
>>> >>> google-code[1], and on the test directory you can find the scenario[2]
>>> >>> I described
>>> >>>
>>> >>> Thanks in advance for your help, any kind of suggestion will be very
>>> >>> appreciated!!!
>>> >>> Simone
>>> >>>
>>> >>>
>>> >>> [1] http://code.google.com/p/ibaguice/source/browse/#svn/trunk
>>> >>> [2]
>>> >>>
>>> >>> http://code.google.com/p/ibaguice/source/browse/trunk/src/test/java/com/ibaguice/SimpleTestCase.java
>>> >>> --
>>> >>> http://www.google.com/profiles/simone.tripodi
>>> >>>
>>> >>> ---------------------------------------------------------------------
>>> >>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> >>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>> >>>
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > http://www.google.com/profiles/simone.tripodi
>>> >
>>>
>>>
>>>
>>> --
>>> http://www.google.com/profiles/simone.tripodi
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>
>>
>
>
>
> --
> http://www.google.com/profiles/simone.tripodi
>



-- 
http://www.google.com/profiles/simone.tripodi

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: [iBatis 3] Cache troubles

Posted by Simone Tripodi <si...@gmail.com>.
Hi Clinton,
sorry my mail was a little confusing - I took advantage from some
spare time during the work to reply quickly :P

So, things are that I was able to use memcached in iBATIS 2 but I'm no
more able to (re)use the same stuff in iBATIS 3 . The "issue" - if I
can call it like this - is that, since memcached doesn't support
namespaces, when flushing the cache, I don't know which statements
I've to  invalidate - in iBATIS2 was quite simple since the group
helped me a lot - and taking inspiration from what you did with
OSCache was more simple.

BTW, here[1] you can find the Cache implementation I've been using -
nothing complicate - that just wraps the memcached client to
store/retrieve the cached objects. Also in this case, I took
inspiration from your cache decorator implementations to see how to
use the Cache interface.

Finally, just to give you a tangible sample of the scenario I speak
(already reported on the iBATIS Wiki): I realized the REST-services
layer for this[2] online-radio using iBATIS2 as persistence layer, the
application is replicated on more than 2 servlet (I had to patch
iBATIS2 in way to supply the IBATIS-555 issue and notified on the dev
ML - [3]) container on different servers, using 3 nodes of memcached
server.

Thanks in advance and thanks for your patience, best regards!!!
Simone

[1] http://tinyurl.com/yb8vxl4
[2] http://www.gooomradio.com/
[3] http://tinyurl.com/ye43gas

On Wed, Nov 18, 2009 at 7:38 PM, Clinton Begin <cl...@gmail.com> wrote:
> Maybe I don't understand...
>
>   * Are you saying that you have this working in iBATIS 2, but can't get it
> to work with iBATIS 3?
>
>   * Or you can't get it to work in either, but understand iB2 better so want
> it described in those terms?
>
> Cheers,
> Clinton
>
> On Wed, Nov 18, 2009 at 2:37 AM, Simone Tripodi <si...@gmail.com>
> wrote:
>>
>> Hi Clinton,
>> unfortunately the official version of Memcached - the one we've been
>> using on production for years - doesn't support namespaces/tags, there
>> is a patched version called Memcached-tags[1] but isn't officially
>> supported :(
>> Can you provide me please any idea how to supply this lack? Is there
>> any way to obtain the cache group, speaking in iBatis2 therms?
>> Thanks in advance, best regards
>> Simone
>>
>> [1] http://code.google.com/p/memcached-tag/
>>
>> On Wed, Nov 18, 2009 at 7:49 AM, Simone Tripodi
>> <si...@gmail.com> wrote:
>> > Hi Clinton,
>> > thanks for your kind reply, I'll let you know ASAP the results of my
>> > tries if you're interested on :)
>> > Best regards,
>> > Simone
>> >
>> > On Wed, Nov 18, 2009 at 12:25 AM, Clinton Begin
>> > <cl...@gmail.com> wrote:
>> >> I'll try to answer in two short statements to see if that helps.  I
>> >> won't
>> >> have time to look through the code anytime soon...
>> >>
>> >>   * I think you can solve the first problem of flushing the whole cache
>> >> by
>> >> passing the cache's namespace to memcached as a cache domain (I'm not
>> >> sure
>> >> what memcached calls them, but essentially flush only a partition or
>> >> group
>> >> of the cached elements (OSCache calls this a domain I believe).
>> >>
>> >>   * The putObject isn't called until the end of the session, or when
>> >> commit
>> >> is called.  It's a transactional cache, so if you rollback a
>> >> transaction
>> >> before closing the session or committing... the cache won't be updated
>> >> with
>> >> potentially erroneous or inconsistent data.
>> >>
>> >> Hope that helps,
>> >> Clinton
>> >>
>> >> On Tue, Nov 17, 2009 at 1:23 PM, Simone Tripodi
>> >> <si...@gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi all guys,
>> >>> I've been doing some experiment using the last beta of iBatis 3 and
>> >>> I've the feeling you happily fixed the inglorious IBATIS-555 issue
>> >>> about the CacheKey unique hashcode generation on different JVMs :)
>> >>>
>> >>> Now I've been porting my old stuff to the new iBatis implementation
>> >>> and everything has worked fine until I plugged-in the cache, I really
>> >>> hope you can help me to understand where I'm wrong: I implemented a
>> >>> Memcached-based Cache class, wrapping the spy memcached client
>> >>> (code.google.com/p/spymemcached/), injecting a singleton instance to
>> >>> the Configuration programmatically using google-guice 2 and finally
>> >>> referenced in the sql-map via the snippet:
>> >>>
>> >>> <cache-ref namespace="memcached"/>
>> >>>
>> >>> What I noticed, reading the logs, is the following:
>> >>> * when flushing the statements defined in the sql map, is called the
>> >>> method org.apache.ibatis.cache.Cache#clear(): that makes me a little
>> >>> worried, because in a memcached context I ideally want to use just one
>> >>> memcached client instance and reference it in the whole application,
>> >>> when performing an insert operation I wouldn't flush the whole cache,
>> >>> but rather remove only the interested statements; since I'm still used
>> >>> to the old iBatis2 cache model, how can I fix it?
>> >>> * no data is cached, the method
>> >>> org.apache.ibatis.cache.Cache#putObject(Object,Object) is never
>> >>> called;
>> >>>
>> >>> All the code I've been producing is public, you can find it on
>> >>> google-code[1], and on the test directory you can find the scenario[2]
>> >>> I described
>> >>>
>> >>> Thanks in advance for your help, any kind of suggestion will be very
>> >>> appreciated!!!
>> >>> Simone
>> >>>
>> >>>
>> >>> [1] http://code.google.com/p/ibaguice/source/browse/#svn/trunk
>> >>> [2]
>> >>>
>> >>> http://code.google.com/p/ibaguice/source/browse/trunk/src/test/java/com/ibaguice/SimpleTestCase.java
>> >>> --
>> >>> http://www.google.com/profiles/simone.tripodi
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >>>
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > http://www.google.com/profiles/simone.tripodi
>> >
>>
>>
>>
>> --
>> http://www.google.com/profiles/simone.tripodi
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>
>



-- 
http://www.google.com/profiles/simone.tripodi

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: [iBatis 3] Cache troubles

Posted by Clinton Begin <cl...@gmail.com>.
Maybe I don't understand...

  * Are you saying that you have this working in iBATIS 2, but can't get it
to work with iBATIS 3?

  * Or you can't get it to work in either, but understand iB2 better so want
it described in those terms?

Cheers,
Clinton

On Wed, Nov 18, 2009 at 2:37 AM, Simone Tripodi <si...@gmail.com>wrote:

> Hi Clinton,
> unfortunately the official version of Memcached - the one we've been
> using on production for years - doesn't support namespaces/tags, there
> is a patched version called Memcached-tags[1] but isn't officially
> supported :(
> Can you provide me please any idea how to supply this lack? Is there
> any way to obtain the cache group, speaking in iBatis2 therms?
> Thanks in advance, best regards
> Simone
>
> [1] http://code.google.com/p/memcached-tag/
>
> On Wed, Nov 18, 2009 at 7:49 AM, Simone Tripodi
> <si...@gmail.com> wrote:
> > Hi Clinton,
> > thanks for your kind reply, I'll let you know ASAP the results of my
> > tries if you're interested on :)
> > Best regards,
> > Simone
> >
> > On Wed, Nov 18, 2009 at 12:25 AM, Clinton Begin <cl...@gmail.com>
> wrote:
> >> I'll try to answer in two short statements to see if that helps.  I
> won't
> >> have time to look through the code anytime soon...
> >>
> >>   * I think you can solve the first problem of flushing the whole cache
> by
> >> passing the cache's namespace to memcached as a cache domain (I'm not
> sure
> >> what memcached calls them, but essentially flush only a partition or
> group
> >> of the cached elements (OSCache calls this a domain I believe).
> >>
> >>   * The putObject isn't called until the end of the session, or when
> commit
> >> is called.  It's a transactional cache, so if you rollback a transaction
> >> before closing the session or committing... the cache won't be updated
> with
> >> potentially erroneous or inconsistent data.
> >>
> >> Hope that helps,
> >> Clinton
> >>
> >> On Tue, Nov 17, 2009 at 1:23 PM, Simone Tripodi <
> simone.tripodi@gmail.com>
> >> wrote:
> >>>
> >>> Hi all guys,
> >>> I've been doing some experiment using the last beta of iBatis 3 and
> >>> I've the feeling you happily fixed the inglorious IBATIS-555 issue
> >>> about the CacheKey unique hashcode generation on different JVMs :)
> >>>
> >>> Now I've been porting my old stuff to the new iBatis implementation
> >>> and everything has worked fine until I plugged-in the cache, I really
> >>> hope you can help me to understand where I'm wrong: I implemented a
> >>> Memcached-based Cache class, wrapping the spy memcached client
> >>> (code.google.com/p/spymemcached/), injecting a singleton instance to
> >>> the Configuration programmatically using google-guice 2 and finally
> >>> referenced in the sql-map via the snippet:
> >>>
> >>> <cache-ref namespace="memcached"/>
> >>>
> >>> What I noticed, reading the logs, is the following:
> >>> * when flushing the statements defined in the sql map, is called the
> >>> method org.apache.ibatis.cache.Cache#clear(): that makes me a little
> >>> worried, because in a memcached context I ideally want to use just one
> >>> memcached client instance and reference it in the whole application,
> >>> when performing an insert operation I wouldn't flush the whole cache,
> >>> but rather remove only the interested statements; since I'm still used
> >>> to the old iBatis2 cache model, how can I fix it?
> >>> * no data is cached, the method
> >>> org.apache.ibatis.cache.Cache#putObject(Object,Object) is never
> >>> called;
> >>>
> >>> All the code I've been producing is public, you can find it on
> >>> google-code[1], and on the test directory you can find the scenario[2]
> >>> I described
> >>>
> >>> Thanks in advance for your help, any kind of suggestion will be very
> >>> appreciated!!!
> >>> Simone
> >>>
> >>>
> >>> [1] http://code.google.com/p/ibaguice/source/browse/#svn/trunk
> >>> [2]
> >>>
> http://code.google.com/p/ibaguice/source/browse/trunk/src/test/java/com/ibaguice/SimpleTestCase.java
> >>> --
> >>> http://www.google.com/profiles/simone.tripodi
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >>> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >>>
> >>
> >>
> >
> >
> >
> > --
> > http://www.google.com/profiles/simone.tripodi
> >
>
>
>
> --
> http://www.google.com/profiles/simone.tripodi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Re: [iBatis 3] Cache troubles

Posted by Simone Tripodi <si...@gmail.com>.
Hi Clinton,
unfortunately the official version of Memcached - the one we've been
using on production for years - doesn't support namespaces/tags, there
is a patched version called Memcached-tags[1] but isn't officially
supported :(
Can you provide me please any idea how to supply this lack? Is there
any way to obtain the cache group, speaking in iBatis2 therms?
Thanks in advance, best regards
Simone

[1] http://code.google.com/p/memcached-tag/

On Wed, Nov 18, 2009 at 7:49 AM, Simone Tripodi
<si...@gmail.com> wrote:
> Hi Clinton,
> thanks for your kind reply, I'll let you know ASAP the results of my
> tries if you're interested on :)
> Best regards,
> Simone
>
> On Wed, Nov 18, 2009 at 12:25 AM, Clinton Begin <cl...@gmail.com> wrote:
>> I'll try to answer in two short statements to see if that helps.  I won't
>> have time to look through the code anytime soon...
>>
>>   * I think you can solve the first problem of flushing the whole cache by
>> passing the cache's namespace to memcached as a cache domain (I'm not sure
>> what memcached calls them, but essentially flush only a partition or group
>> of the cached elements (OSCache calls this a domain I believe).
>>
>>   * The putObject isn't called until the end of the session, or when commit
>> is called.  It's a transactional cache, so if you rollback a transaction
>> before closing the session or committing... the cache won't be updated with
>> potentially erroneous or inconsistent data.
>>
>> Hope that helps,
>> Clinton
>>
>> On Tue, Nov 17, 2009 at 1:23 PM, Simone Tripodi <si...@gmail.com>
>> wrote:
>>>
>>> Hi all guys,
>>> I've been doing some experiment using the last beta of iBatis 3 and
>>> I've the feeling you happily fixed the inglorious IBATIS-555 issue
>>> about the CacheKey unique hashcode generation on different JVMs :)
>>>
>>> Now I've been porting my old stuff to the new iBatis implementation
>>> and everything has worked fine until I plugged-in the cache, I really
>>> hope you can help me to understand where I'm wrong: I implemented a
>>> Memcached-based Cache class, wrapping the spy memcached client
>>> (code.google.com/p/spymemcached/), injecting a singleton instance to
>>> the Configuration programmatically using google-guice 2 and finally
>>> referenced in the sql-map via the snippet:
>>>
>>> <cache-ref namespace="memcached"/>
>>>
>>> What I noticed, reading the logs, is the following:
>>> * when flushing the statements defined in the sql map, is called the
>>> method org.apache.ibatis.cache.Cache#clear(): that makes me a little
>>> worried, because in a memcached context I ideally want to use just one
>>> memcached client instance and reference it in the whole application,
>>> when performing an insert operation I wouldn't flush the whole cache,
>>> but rather remove only the interested statements; since I'm still used
>>> to the old iBatis2 cache model, how can I fix it?
>>> * no data is cached, the method
>>> org.apache.ibatis.cache.Cache#putObject(Object,Object) is never
>>> called;
>>>
>>> All the code I've been producing is public, you can find it on
>>> google-code[1], and on the test directory you can find the scenario[2]
>>> I described
>>>
>>> Thanks in advance for your help, any kind of suggestion will be very
>>> appreciated!!!
>>> Simone
>>>
>>>
>>> [1] http://code.google.com/p/ibaguice/source/browse/#svn/trunk
>>> [2]
>>> http://code.google.com/p/ibaguice/source/browse/trunk/src/test/java/com/ibaguice/SimpleTestCase.java
>>> --
>>> http://www.google.com/profiles/simone.tripodi
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>
>>
>
>
>
> --
> http://www.google.com/profiles/simone.tripodi
>



-- 
http://www.google.com/profiles/simone.tripodi

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: [iBatis 3] Cache troubles

Posted by Simone Tripodi <si...@gmail.com>.
Hi Clinton,
thanks for your kind reply, I'll let you know ASAP the results of my
tries if you're interested on :)
Best regards,
Simone

On Wed, Nov 18, 2009 at 12:25 AM, Clinton Begin <cl...@gmail.com> wrote:
> I'll try to answer in two short statements to see if that helps.  I won't
> have time to look through the code anytime soon...
>
>   * I think you can solve the first problem of flushing the whole cache by
> passing the cache's namespace to memcached as a cache domain (I'm not sure
> what memcached calls them, but essentially flush only a partition or group
> of the cached elements (OSCache calls this a domain I believe).
>
>   * The putObject isn't called until the end of the session, or when commit
> is called.  It's a transactional cache, so if you rollback a transaction
> before closing the session or committing... the cache won't be updated with
> potentially erroneous or inconsistent data.
>
> Hope that helps,
> Clinton
>
> On Tue, Nov 17, 2009 at 1:23 PM, Simone Tripodi <si...@gmail.com>
> wrote:
>>
>> Hi all guys,
>> I've been doing some experiment using the last beta of iBatis 3 and
>> I've the feeling you happily fixed the inglorious IBATIS-555 issue
>> about the CacheKey unique hashcode generation on different JVMs :)
>>
>> Now I've been porting my old stuff to the new iBatis implementation
>> and everything has worked fine until I plugged-in the cache, I really
>> hope you can help me to understand where I'm wrong: I implemented a
>> Memcached-based Cache class, wrapping the spy memcached client
>> (code.google.com/p/spymemcached/), injecting a singleton instance to
>> the Configuration programmatically using google-guice 2 and finally
>> referenced in the sql-map via the snippet:
>>
>> <cache-ref namespace="memcached"/>
>>
>> What I noticed, reading the logs, is the following:
>> * when flushing the statements defined in the sql map, is called the
>> method org.apache.ibatis.cache.Cache#clear(): that makes me a little
>> worried, because in a memcached context I ideally want to use just one
>> memcached client instance and reference it in the whole application,
>> when performing an insert operation I wouldn't flush the whole cache,
>> but rather remove only the interested statements; since I'm still used
>> to the old iBatis2 cache model, how can I fix it?
>> * no data is cached, the method
>> org.apache.ibatis.cache.Cache#putObject(Object,Object) is never
>> called;
>>
>> All the code I've been producing is public, you can find it on
>> google-code[1], and on the test directory you can find the scenario[2]
>> I described
>>
>> Thanks in advance for your help, any kind of suggestion will be very
>> appreciated!!!
>> Simone
>>
>>
>> [1] http://code.google.com/p/ibaguice/source/browse/#svn/trunk
>> [2]
>> http://code.google.com/p/ibaguice/source/browse/trunk/src/test/java/com/ibaguice/SimpleTestCase.java
>> --
>> http://www.google.com/profiles/simone.tripodi
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>
>



-- 
http://www.google.com/profiles/simone.tripodi

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: [iBatis 3] Cache troubles

Posted by Clinton Begin <cl...@gmail.com>.
I'll try to answer in two short statements to see if that helps.  I won't
have time to look through the code anytime soon...

  * I think you can solve the first problem of flushing the whole cache by
passing the cache's namespace to memcached as a cache domain (I'm not sure
what memcached calls them, but essentially flush only a partition or group
of the cached elements (OSCache calls this a domain I believe).

  * The putObject isn't called until the end of the session, or when commit
is called.  It's a transactional cache, so if you rollback a transaction
before closing the session or committing... the cache won't be updated with
potentially erroneous or inconsistent data.

Hope that helps,
Clinton

On Tue, Nov 17, 2009 at 1:23 PM, Simone Tripodi <si...@gmail.com>wrote:

> Hi all guys,
> I've been doing some experiment using the last beta of iBatis 3 and
> I've the feeling you happily fixed the inglorious IBATIS-555 issue
> about the CacheKey unique hashcode generation on different JVMs :)
>
> Now I've been porting my old stuff to the new iBatis implementation
> and everything has worked fine until I plugged-in the cache, I really
> hope you can help me to understand where I'm wrong: I implemented a
> Memcached-based Cache class, wrapping the spy memcached client
> (code.google.com/p/spymemcached/), injecting a singleton instance to
> the Configuration programmatically using google-guice 2 and finally
> referenced in the sql-map via the snippet:
>
> <cache-ref namespace="memcached"/>
>
> What I noticed, reading the logs, is the following:
> * when flushing the statements defined in the sql map, is called the
> method org.apache.ibatis.cache.Cache#clear(): that makes me a little
> worried, because in a memcached context I ideally want to use just one
> memcached client instance and reference it in the whole application,
> when performing an insert operation I wouldn't flush the whole cache,
> but rather remove only the interested statements; since I'm still used
> to the old iBatis2 cache model, how can I fix it?
> * no data is cached, the method
> org.apache.ibatis.cache.Cache#putObject(Object,Object) is never
> called;
>
> All the code I've been producing is public, you can find it on
> google-code[1], and on the test directory you can find the scenario[2]
> I described
>
> Thanks in advance for your help, any kind of suggestion will be very
> appreciated!!!
> Simone
>
>
> [1] http://code.google.com/p/ibaguice/source/browse/#svn/trunk
> [2]
> http://code.google.com/p/ibaguice/source/browse/trunk/src/test/java/com/ibaguice/SimpleTestCase.java
> --
> http://www.google.com/profiles/simone.tripodi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>