You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Steven Pannell <st...@zooplus.com> on 2005/08/03 09:00:18 UTC

cache timeout

Hi,

I'm using oscache in my map file like:

    <cacheModel id="ResourceCache" type="OSCACHE">
		<flushInterval hours="2"></flushInterval>
    </cacheModel>

This is OK but what I would really like is to set the flushInterval using
standard cron syntax.  OSCACHE supports this.  Is this implemented in
iBatis?? If so how's it working?.

If not any chance of getting the cron syntax added to the cacheModel tags??
because this is much more predictable then setting an interval for the
cache.

Thanks,
Steve.

Lazy loading

Posted by Oleg Shpak <ol...@rap-x.com>.
Hello,

I'm using lazy loading in iBatis, but this appears to fetch my object
eagerly, effectively increasing the number of statements to exactly N+1.
Lazy loading for collection does work however.
I did some research and found that iBatis does not create proxies for
objects, only for collections.

Am I missing something? After reading the docs I thought that lazy
loading applies to both objects and collections.

Here is what is going in
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader, lines
66-74
----------------8<---------------
  public Object loadResult() throws SQLException {
    if (Collection.class.isAssignableFrom(targetType)) {
      InvocationHandler handler = new LazyResultLoader(client,
statementName, parameterObject, targetType);
      ClassLoader cl = targetType.getClassLoader();
      return Proxy.newProxyInstance(cl, LIST_INTERFACES, handler);
    } else {
      return ResultLoader.getResult(client, statementName,
parameterObject, targetType);
    }
  }
----------------8<---------------

The same is true for EnhancedLazyResultLoader

Thanks in advance,
Oleg







Re: cache timeout

Posted by Oleg Shpak <ol...@rap-x.com>.
Hello,

I'm using lazy loading in iBatis, but this appears to fetch my object 
eagerly, effectively increasing the number of statements to exactly N+1. 
Lazy loading for collection does work however.
I did some research and found that iBatis does not create proxies for 
objects, only for collections.

Am I missing something? After reading the docs I thought that lazy 
loading applies to both objects and collections.

Here is what is going in 
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader, lines  
66-74
----------------8<---------------
  public Object loadResult() throws SQLException {
    if (Collection.class.isAssignableFrom(targetType)) {
      InvocationHandler handler = new LazyResultLoader(client, 
statementName, parameterObject, targetType);
      ClassLoader cl = targetType.getClassLoader();
      return Proxy.newProxyInstance(cl, LIST_INTERFACES, handler);
    } else {
      return ResultLoader.getResult(client, statementName, 
parameterObject, targetType);
    }
  }
----------------8<---------------

The same is true for EnhancedLazyResultLoader

Thanks in advance,
Oleg






Re: cache timeout

Posted by Oleg Shpak <ol...@rap-x.com>.
Hello,

I'm using lazy loading in iBatis, but this appears to fetch my object 
eagerly, effectively increasing the number of statements to exactly N+1. 
Lazy loading for collection does work however.
I did some research and found that iBatis does not create proxies for 
objects, only for collections.

Am I missing something? After reading the docs I thought that lazy 
loading applies to both objects and collections.

Here is what is going in 
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader, lines  
66-74
----------------8<---------------
  public Object loadResult() throws SQLException {
    if (Collection.class.isAssignableFrom(targetType)) {
      InvocationHandler handler = new LazyResultLoader(client, 
statementName, parameterObject, targetType);
      ClassLoader cl = targetType.getClassLoader();
      return Proxy.newProxyInstance(cl, LIST_INTERFACES, handler);
    } else {
      return ResultLoader.getResult(client, statementName, 
parameterObject, targetType);
    }
  }
----------------8<---------------

The same is true for EnhancedLazyResultLoader

Thanks in advance,
Oleg






Lazy loading

Posted by Oleg Shpak <ol...@rap-x.com>.
Hello,

I'm using lazy loading in iBatis, but this appears to fetch my object
eagerly, effectively increasing the number of statements to exactly N+1.
Lazy loading for collection does work however.
I did some research and found that iBatis does not create proxies for
objects, only for collections.

Am I missing something? After reading the docs I thought that lazy
loading applies to both objects and collections.

Here is what is going in
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader, lines
66-74
----------------8<---------------
  public Object loadResult() throws SQLException {
    if (Collection.class.isAssignableFrom(targetType)) {
      InvocationHandler handler = new LazyResultLoader(client,
statementName, parameterObject, targetType);
      ClassLoader cl = targetType.getClassLoader();
      return Proxy.newProxyInstance(cl, LIST_INTERFACES, handler);
    } else {
      return ResultLoader.getResult(client, statementName,
parameterObject, targetType);
    }
  }
----------------8<---------------

The same is true for EnhancedLazyResultLoader

Thanks in advance,
Oleg

PS Sorry if this message appeared more than once, I had weird problems 
with my SMTP server.





Re: cache timeout

Posted by Larry Meadors <la...@gmail.com>.
I do not use OSCache, but can you set it with a property?

<cacheModel id="cache" type="xxx">
<property name="???" value="???" />
</cacheModel>

Larry

On 8/3/05, Steven Pannell <st...@zooplus.com> wrote:
> 
> Hi,
> 
> I'm using oscache in my map file like:
> 
> <cacheModel id="ResourceCache" type="OSCACHE">
> <flushInterval hours="2"></flushInterval>
> </cacheModel>
> 
> This is OK but what I would really like is to set the flushInterval using
> standard cron syntax. OSCACHE supports this. Is this implemented in
> iBatis?? If so how's it working?.
> 
> If not any chance of getting the cron syntax added to the cacheModel 
> tags??
> because this is much more predictable then setting an interval for the
> cache.
> 
> Thanks,
> Steve.
>