[JBoss Cache] - How to model data to be stored in JBoss Cache
by Sanjit Mohanty
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&cont...]
14 years, 5 months