Does JCache.get with a CacheLoader block anyone else trying to get that Element?

View: New views
3 Messages — Rating Filter:   Alert me  

Does JCache.get with a CacheLoader block anyone else trying to get that Element?

by Travis R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do other threads block on that particular key until the element is loaded?



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Parent Message unknown Re: Does JCache.get with a CacheLoader block anyone else trying to get that Element?

by Travis R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just a quick question on how this should behave.

Lets say you had 100 threads all try to get from a cache with the same key, would it call the CacheLoader 100 times for the same key or once and return null for the next 99 until the item is fully loaded?

Travis

On Mon, May 26, 2008 at 9:56 PM, Greg Luck <gluck@...> wrote:
Travis

Not as implemented. That is not a part of the spec. The SelfPopulatingCache (in constructs) does.


On 27/05/2008, at 2:35 AM, Travis Reeder wrote:

Do other threads block on that particular key until the element is loaded?


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Parent Message unknown Re: Does JCache.get with a CacheLoader block anyone else trying to get that Element?

by gregluck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Travis




On 24/07/2008, at 4:01 AM, Travis Reeder wrote:

Just a quick question on how this should behave.

Lets say you had 100 threads all try to get from a cache with the same key, would it call the CacheLoader 100 times for the same key or once and return null for the next 99 until the item is fully loaded?



It would call the loader 100 times.

If you want more sophisticated behaviour use SelfPopulatingCache, which will block the other requests while the first one does the work.

This is yet one more thing we need to toss around in the EG. From the point of view of protecting backing resources the blocking approach is much better.

Travis

On Mon, May 26, 2008 at 9:56 PM, Greg Luck <gluck@...> wrote:
Travis

Not as implemented. That is not a part of the spec. The SelfPopulatingCache (in constructs) does.


On 27/05/2008, at 2:35 AM, Travis Reeder wrote:

Do other threads block on that particular key until the element is loaded?


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list
LightInTheBox - Buy quality products at wholesale price