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

Ask Your Question

Possible to access persisted data that has expired from space?


I'm using GS with async mirror service to persist some application transaction entries into a DB. I don't need (or want) the application data to remain in memory, so I made the lease time very short. The data is persisted in the DB as expected and does not remain in the space (memory).

Example: I have some application transaction data that refers to some common data. I want the common data persisted but I don't want it duplicated for each transaction. For example, I create a transaction tx1 that refers to data1. tx1 and data1 are written to the space, persisted, and their leases expire. Then, some undetermined time in the future, I create another transaction tx2 that also refers to data1.

Using the gigaspaces API, is it possible to know that data1 exists in my persistence storage, even though it is not in the space? Or perhaps another way to put it, can I write tx2 to the space and hope that data1 is not persisted twice?

Thanks Darryl

asked 2014-10-06 16:46:02 -0500

dncheu1's avatar
edit retag flag offensive close merge delete


btw we are using ALL_IN_CACHE mode, not LRU-CACHE

dncheu1's avatar dncheu1  ( 2014-10-08 12:12:40 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

You will have to run in LRU mode in such a case. Examples for SpaceDataSource API can be found here: http://docs.gigaspaces.com/xap100/spa...

Advanced implementations can be found here: https://github.com/OpenSpaces/OpenSpa...

The issue with this approach the objects will be loaded into the space.

You might want to implement a space service that will access the database directly instead.

answered 2014-10-08 12:36:41 -0500

shay hassidim's avatar
edit flag offensive delete link more


hi Shay, I took your suggestion to implement a space service to access the database. I'm using the existing sessionFactory that is specified in the pu.xml and inject it into a bean which can access the database through hibernate. I can find all the objects by creating an sql query, but when I try to cast it back to the original object, I get a ClassCastException. Is this happening because we use the space to persist the object but not read it?

dncheu1's avatar dncheu1  ( 2014-10-09 08:18:32 -0500 )edit

Nevermind, this was a problem with hibernate

dncheu1's avatar dncheu1  ( 2014-10-09 09:50:52 -0500 )edit

Sounds like you are looking for the exact opposite of the MEMORY_ONLY_SEARCH modifier behavior: http://docs.gigaspaces.com/xap100adm/...


answered 2014-10-08 12:27:19 -0500

shay hassidim's avatar
edit flag offensive delete link more


That's right, the data we would be looking for would not be in the memory cache anymore, only in the persistent storage. It sounds like I would have to go through the SpaceDataSource API to look up this data? (correct?) Are there any code examples of how to do this?

dncheu1's avatar dncheu1  ( 2014-10-08 12:29:31 -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: 2014-10-06 16:46:02 -0500

Seen: 75 times

Last updated: Oct 08 '14