[jboss-user] [JBoss Cache] - How to model data to be stored in JBoss Cache
Sanjit Mohanty
do-not-reply at jboss.com
Sun Aug 1 06:32:48 EDT 2010
Sanjit Mohanty [http://community.jboss.org/people/sanjit...] created the discussion
"How to model data to be stored in JBoss Cache"
To view the discussion, visit: http://community.jboss.org/message/555300#555300
--------------------------------------------------------------
Hi,
I understand JBoss cache internally stores data in a map i.e. in a key-value pair.
So, incase i need to search for a data in the cache, i need to pass the key and i can retrieve the value.
But what if, i need to retrieve key based on value!
To clarify more on this, following is an example:
Consider i want to store empId, deptId in JBoss cache.
empId = unique employee ID
deptId = department ID. A particular employee can be associated to multiple departments.
I want to do following 2 things:
(1) Get the deptIds based on an empId
(2) Get the empIds based on a deptId
Now, if i make empId as key & store deptId as it's value, then i can achieve (1) without any issues but it will be a problem for (2) because i need to do a full traversal of values, which is in-efficient!
How should i model my data in this scenario?
Thanks In advance!
_Sanjit
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/555300#555300]
Start a new discussion in JBoss Cache at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100801/c817a580/attachment.html
More information about the jboss-user
mailing list