We had the same issue, and what we did was cached a bunch of key matchups along with the object. So we would do something like this:
cache.put("/foo/byId", Id, Object)
cache.put ("/keylookup", "/foo/byName," + Name, "/foo/byId," + Id)
That way when it comes lookup time you can first do a keylookup on "/foo/byName," + Name to see if it has another node (In this case "/foo/byId," + Id, then grab that one.
If you find a better solution please let me know.
Why don't you use this ? :
You'll have 2 bindings for the *same* object. References were introduced by Ben in the 1.0 release of JBossCache