Author |
Message
|
IIB4VV |
Posted: Tue Jul 24, 2018 8:28 pm Post subject: global cache for multiple keys |
|
|
Newbie
Joined: 02 Jan 2017 Posts: 7
|
Hi I have a requirement to use the global cache but I have multiple inputs and multiple outputs like
key1,key2,key3 and value1,value2,value3,value4.
If all keys matches with my input then i need to fetch the all 4 values.
Please suggest how can i do with global cache.
My understanding is global cache library will work with only one key-value pair.
Please suggest if there is a way,
Thanks,
VV |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 25, 2018 1:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
and you have no idea how to stick 3 fields into on value and 4 fields into the other???  _________________ MQ & Broker admin |
|
Back to top |
|
 |
IIB4VV |
Posted: Wed Jul 25, 2018 2:40 am Post subject: |
|
|
Newbie
Joined: 02 Jan 2017 Posts: 7
|
3 keys and 4 values are not fixed, it can vary.
I know to add values as array, but I want to know is there any way to add keys also into array and search the key values as array and fetch the values array if all keys are matched.
My last option will be using delimiter for keys and values. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 26, 2018 2:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
IIB4VV wrote: |
3 keys and 4 values are not fixed, it can vary.
I know to add values as array, but I want to know is there any way to add keys also into array and search the key values as array and fetch the values array if all keys are matched.
My last option will be using delimiter for keys and values. |
Would nearly be better to use XML. Your key needs to have 3 fields and be serializable...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
IIB4VV |
Posted: Thu Jul 26, 2018 4:58 am Post subject: |
|
|
Newbie
Joined: 02 Jan 2017 Posts: 7
|
But Global cache is accepting only one key right, how can I cache xml with 3 keys. Please help. |
|
Back to top |
|
 |
timber |
Posted: Thu Jul 26, 2018 2:15 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
how can I cache xml with 3 keys |
I think you know this already, but you were hoping to be proved wrong...
The answer is, you cannot. The global cache is essentially a hashmap. If you want to use a composite key then you have to perform the same tricks as you would use in (say) Java. Construct a string containing all 3 values. Or create an object containing all 3 values and use it as the key (but remember to only create one key object per unique combintion of values!). |
|
Back to top |
|
 |
IIB4VV |
Posted: Thu Jul 26, 2018 9:33 pm Post subject: |
|
|
Newbie
Joined: 02 Jan 2017 Posts: 7
|
thank you... Looks like there is not other option then. then let me either go with shared row or combine all the keys to one string with global cache. |
|
Back to top |
|
 |
|