You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Benedikt Ritter <be...@gmail.com> on 2012/08/13 13:11:20 UTC

[BeanUtils2] WeakHashMap is not a cache (?)

Hi,

I just came across this post:
http://www.codeinstructions.com/2008/09/weakhashmap-is-not-cache-understanding.html
Now i'm wondering what you think about it, since we are using the
WeakHashMap for BU2. Maybe we should be looking for an alternative
caching mechanism?
Any suggestions?

Best regards,
Benedikt

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


Re: [BeanUtils2] WeakHashMap is not a cache (?)

Posted by Benedikt Ritter <be...@gmail.com>.
Hi,

2012/8/13 Adrian Crum <ad...@sandglass-software.com>:
> http://ci.apache.org/projects/ofbiz/site/javadocs/org/ofbiz/base/util/cache/package-summary.html
>

thanks for the input! As far as I understand the LRUMap seems to be
more appropriate than a map using some sort of reference. But I'll
have a look anyway!

The LRUMap from commons is not thread safe so we will have to deal with that.

Benedikt

> -Adrian
>
>
> On 8/13/2012 2:51 PM, Simone Tripodi wrote:
>>
>> Hi Adrian,
>>
>> any direct link? TIA!
>> -Simo
>>
>> http://people.apache.org/~simonetripodi/
>> http://simonetripodi.livejournal.com/
>> http://twitter.com/simonetripodi
>> http://www.99soft.org/
>>
>>
>> On Mon, Aug 13, 2012 at 3:19 PM, Adrian Crum
>> <ad...@sandglass-software.com> wrote:
>>>
>>> Apache OFBiz has a soft reference cache implementation.
>>>
>>> -Adrian
>>>
>>>
>>> On 8/13/2012 1:07 PM, Simone Tripodi wrote:
>>>>
>>>> guten morgen Bene,
>>>>
>>>> I have not a strong opinion about it, I am convinced anyway that the
>>>> original BU authors (BU2 at the beginning was a tentative to refurbish
>>>> BU) adopted the WeakHashMap NOT with the purpose of implementing a
>>>> `cache` in the strict sense we are used to. We should go back to the
>>>> ML history and find related discussions about it to understand that
>>>> decision.
>>>>
>>>> If we need to switch implementation, in Apache Cocoon we developed a
>>>> simple LRU cache hacking the LinkedHashMap, we could import and adapt
>>>> that version - it would be better keeping BU2 dependencies-less.
>>>>
>>>> Thanks,
>>>> -Simo
>>>>
>>>> [1] http://s.apache.org/9zN
>>>>
>>>> http://people.apache.org/~simonetripodi/
>>>> http://simonetripodi.livejournal.com/
>>>> http://twitter.com/simonetripodi
>>>> http://www.99soft.org/
>>>>
>>>>
>>>> On Mon, Aug 13, 2012 at 1:11 PM, Benedikt Ritter <be...@gmail.com>
>>>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I just came across this post:
>>>>>
>>>>>
>>>>> http://www.codeinstructions.com/2008/09/weakhashmap-is-not-cache-understanding.html
>>>>> Now i'm wondering what you think about it, since we are using the
>>>>> WeakHashMap for BU2. Maybe we should be looking for an alternative
>>>>> caching mechanism?
>>>>> Any suggestions?
>>>>>
>>>>> Best regards,
>>>>> Benedikt
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Re: [BeanUtils2] WeakHashMap is not a cache (?)

Posted by Adrian Crum <ad...@sandglass-software.com>.
http://ci.apache.org/projects/ofbiz/site/javadocs/org/ofbiz/base/util/cache/package-summary.html

-Adrian

On 8/13/2012 2:51 PM, Simone Tripodi wrote:
> Hi Adrian,
>
> any direct link? TIA!
> -Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
> On Mon, Aug 13, 2012 at 3:19 PM, Adrian Crum
> <ad...@sandglass-software.com> wrote:
>> Apache OFBiz has a soft reference cache implementation.
>>
>> -Adrian
>>
>>
>> On 8/13/2012 1:07 PM, Simone Tripodi wrote:
>>> guten morgen Bene,
>>>
>>> I have not a strong opinion about it, I am convinced anyway that the
>>> original BU authors (BU2 at the beginning was a tentative to refurbish
>>> BU) adopted the WeakHashMap NOT with the purpose of implementing a
>>> `cache` in the strict sense we are used to. We should go back to the
>>> ML history and find related discussions about it to understand that
>>> decision.
>>>
>>> If we need to switch implementation, in Apache Cocoon we developed a
>>> simple LRU cache hacking the LinkedHashMap, we could import and adapt
>>> that version - it would be better keeping BU2 dependencies-less.
>>>
>>> Thanks,
>>> -Simo
>>>
>>> [1] http://s.apache.org/9zN
>>>
>>> http://people.apache.org/~simonetripodi/
>>> http://simonetripodi.livejournal.com/
>>> http://twitter.com/simonetripodi
>>> http://www.99soft.org/
>>>
>>>
>>> On Mon, Aug 13, 2012 at 1:11 PM, Benedikt Ritter <be...@gmail.com>
>>> wrote:
>>>> Hi,
>>>>
>>>> I just came across this post:
>>>>
>>>> http://www.codeinstructions.com/2008/09/weakhashmap-is-not-cache-understanding.html
>>>> Now i'm wondering what you think about it, since we are using the
>>>> WeakHashMap for BU2. Maybe we should be looking for an alternative
>>>> caching mechanism?
>>>> Any suggestions?
>>>>
>>>> Best regards,
>>>> Benedikt
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>


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


Re: [BeanUtils2] WeakHashMap is not a cache (?)

Posted by Simone Tripodi <si...@apache.org>.
Hi Adrian,

any direct link? TIA!
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/


On Mon, Aug 13, 2012 at 3:19 PM, Adrian Crum
<ad...@sandglass-software.com> wrote:
> Apache OFBiz has a soft reference cache implementation.
>
> -Adrian
>
>
> On 8/13/2012 1:07 PM, Simone Tripodi wrote:
>>
>> guten morgen Bene,
>>
>> I have not a strong opinion about it, I am convinced anyway that the
>> original BU authors (BU2 at the beginning was a tentative to refurbish
>> BU) adopted the WeakHashMap NOT with the purpose of implementing a
>> `cache` in the strict sense we are used to. We should go back to the
>> ML history and find related discussions about it to understand that
>> decision.
>>
>> If we need to switch implementation, in Apache Cocoon we developed a
>> simple LRU cache hacking the LinkedHashMap, we could import and adapt
>> that version - it would be better keeping BU2 dependencies-less.
>>
>> Thanks,
>> -Simo
>>
>> [1] http://s.apache.org/9zN
>>
>> http://people.apache.org/~simonetripodi/
>> http://simonetripodi.livejournal.com/
>> http://twitter.com/simonetripodi
>> http://www.99soft.org/
>>
>>
>> On Mon, Aug 13, 2012 at 1:11 PM, Benedikt Ritter <be...@gmail.com>
>> wrote:
>>>
>>> Hi,
>>>
>>> I just came across this post:
>>>
>>> http://www.codeinstructions.com/2008/09/weakhashmap-is-not-cache-understanding.html
>>> Now i'm wondering what you think about it, since we are using the
>>> WeakHashMap for BU2. Maybe we should be looking for an alternative
>>> caching mechanism?
>>> Any suggestions?
>>>
>>> Best regards,
>>> Benedikt
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Re: [BeanUtils2] WeakHashMap is not a cache (?)

Posted by Adrian Crum <ad...@sandglass-software.com>.
Apache OFBiz has a soft reference cache implementation.

-Adrian

On 8/13/2012 1:07 PM, Simone Tripodi wrote:
> guten morgen Bene,
>
> I have not a strong opinion about it, I am convinced anyway that the
> original BU authors (BU2 at the beginning was a tentative to refurbish
> BU) adopted the WeakHashMap NOT with the purpose of implementing a
> `cache` in the strict sense we are used to. We should go back to the
> ML history and find related discussions about it to understand that
> decision.
>
> If we need to switch implementation, in Apache Cocoon we developed a
> simple LRU cache hacking the LinkedHashMap, we could import and adapt
> that version - it would be better keeping BU2 dependencies-less.
>
> Thanks,
> -Simo
>
> [1] http://s.apache.org/9zN
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
> On Mon, Aug 13, 2012 at 1:11 PM, Benedikt Ritter <be...@gmail.com> wrote:
>> Hi,
>>
>> I just came across this post:
>> http://www.codeinstructions.com/2008/09/weakhashmap-is-not-cache-understanding.html
>> Now i'm wondering what you think about it, since we are using the
>> WeakHashMap for BU2. Maybe we should be looking for an alternative
>> caching mechanism?
>> Any suggestions?
>>
>> Best regards,
>> Benedikt
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>


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


Re: [BeanUtils2] WeakHashMap is not a cache (?)

Posted by James Carman <ja...@carmanconsulting.com>.
Commons Collections has an LRUMap class that we could "borrow", perhaps?

On Mon, Aug 13, 2012 at 8:07 AM, Simone Tripodi
<si...@apache.org> wrote:
> guten morgen Bene,
>
> I have not a strong opinion about it, I am convinced anyway that the
> original BU authors (BU2 at the beginning was a tentative to refurbish
> BU) adopted the WeakHashMap NOT with the purpose of implementing a
> `cache` in the strict sense we are used to. We should go back to the
> ML history and find related discussions about it to understand that
> decision.
>
> If we need to switch implementation, in Apache Cocoon we developed a
> simple LRU cache hacking the LinkedHashMap, we could import and adapt
> that version - it would be better keeping BU2 dependencies-less.
>
> Thanks,
> -Simo
>
> [1] http://s.apache.org/9zN
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
> On Mon, Aug 13, 2012 at 1:11 PM, Benedikt Ritter <be...@gmail.com> wrote:
>> Hi,
>>
>> I just came across this post:
>> http://www.codeinstructions.com/2008/09/weakhashmap-is-not-cache-understanding.html
>> Now i'm wondering what you think about it, since we are using the
>> WeakHashMap for BU2. Maybe we should be looking for an alternative
>> caching mechanism?
>> Any suggestions?
>>
>> Best regards,
>> Benedikt
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Re: [BeanUtils2] WeakHashMap is not a cache (?)

Posted by Simone Tripodi <si...@apache.org>.
guten morgen Bene,

I have not a strong opinion about it, I am convinced anyway that the
original BU authors (BU2 at the beginning was a tentative to refurbish
BU) adopted the WeakHashMap NOT with the purpose of implementing a
`cache` in the strict sense we are used to. We should go back to the
ML history and find related discussions about it to understand that
decision.

If we need to switch implementation, in Apache Cocoon we developed a
simple LRU cache hacking the LinkedHashMap, we could import and adapt
that version - it would be better keeping BU2 dependencies-less.

Thanks,
-Simo

[1] http://s.apache.org/9zN

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/


On Mon, Aug 13, 2012 at 1:11 PM, Benedikt Ritter <be...@gmail.com> wrote:
> Hi,
>
> I just came across this post:
> http://www.codeinstructions.com/2008/09/weakhashmap-is-not-cache-understanding.html
> Now i'm wondering what you think about it, since we are using the
> WeakHashMap for BU2. Maybe we should be looking for an alternative
> caching mechanism?
> Any suggestions?
>
> Best regards,
> Benedikt
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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