Performance on GenericDelegator.create when having lot of cache

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Performance on GenericDelegator.create when having lot of cache

Patrick Antivackis
Hello,
I have some performance issue when I create a new record in
ProductCategoryMember and there are thousands of lines in the cache of this
entity. Looking at the code, I discovered that the GenericDelegator.create
is calling this.clearCacheLine(value);

My question is why we need to clear the cache when we are inserting a new
value ?
Regards
Reply | Threaded
Open this post in threaded view
|

Re: Performance on GenericDelegator.create when having lot of cache

Adam Heath-2
Patrick Antivackis wrote:
> Hello,
> I have some performance issue when I create a new record in
> ProductCategoryMember and there are thousands of lines in the cache of this
> entity. Looking at the code, I discovered that the GenericDelegator.create
> is calling this.clearCacheLine(value);
>
> My question is why we need to clear the cache when we are inserting a new
> value ?

Because some previous delegator call did a findByAnd, or some other
call that returned a list.  The condition used during that previous
call may actually be able to include this *new* value that is being
created.  So, the previous list value needs to be cleared, so that
when it is rerun, it'll have a chance to pull in the newly created
value from the database.