Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

External data source question

I just read the following paragraph:

{quote} Count Operation

The scope of IJSpace.count() or GigaSpace.count() and IMap.Size() is the data stored within the space. These methods do not take into account the data stored within the underlying data source. {quote}

If that's the case, how can I do an accurate count when using LRU caching policy?



{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2834]{quote}

asked 2009-01-29 11:19:48 -0500

noiseba gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

Yes - A space running with ExternalDataSource and LRU cache policy would
use its cached data when performing IJSpace.count() or GigaSpace.count()
or IMap.Size() operations and will not access the database.

If you want to get a count for the data within the database you should
use an executor. This will access the database directly, perform the
relevant call and return result to the application without trying to
load data back into the space as done with readMultiple call.

See here simple example how to use Executors:


answered 2009-01-29 11:33:19 -0500

shay hassidim gravatar image
edit flag offensive delete link more


One more question:

How about readMultiple? Does it have the same limitation? By that, I mean whether it will only read from the space but not the database when using LRU policy.



Edited by: Simon Lin on Jan 29, 2009 12:21 PM

noiseba gravatar imagenoiseba ( 2009-01-29 12:21:43 -0500 )edit

readMultiple will read from the database if there are no enough matching objects found within the space cache.


shay hassidim gravatar imageshay hassidim ( 2009-01-30 04:47:02 -0500 )edit

Thanks Shay.

What about the "autoGenerate=false" annotation on SpaceId? Our stuff seems to work without it.


answered 2009-01-29 11:37:31 -0500

noiseba gravatar image
edit flag offensive delete link more


This limitation has been removed with latest versions. Still - it is recommended to have the autoGenerate=false - without it, you will not be able to perform update operations. Shay

shay hassidim gravatar imageshay hassidim ( 2009-01-29 11:41:49 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2009-01-29 11:19:48 -0500

Seen: 28 times

Last updated: Jan 29 '09