Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I generate unique key using two different numbers and then retrieve this key by using one of these numbers
    primarykey
    data
    text
    <p>Having two different numbers I have to generate a unique key. For example I have 37 and 8, and by using XOR on them I will get 45, that’s my unique key. But then I need to retrieve this unique key by using one of those numbers (37 or 8). So question is, how can I generate unique key using two different numbers and then retrieve this key by using one of these numbers? It’s allowed to use some third number (mask, key, etc.), but I need a unique key to be really unique.</p> <hr> <p>Edit:</p> <p>All right guys, sorry for probably non clear question. I have in-memory key-object storage. Memcached for example, no matters. There I can add some value and specify string key for an object e.g. Cache.Add(“mykey”, myobj); But in my app same object have two identifiers, integer and string. So I want to be able add into cache like this Cache.Add(“mykey”, 1, myobj); And then to get same cached object by using one of the identifiers. Like this Cache.Get(1) or Cache.Get(“mykey”); String can be computed into hash, so that’s why I asked about two integers. My storage is SharedCache ectualy. I just don’t want to change core of SharedCahce, so probably there is a solution for computing key by one of the identifiers.</p> <hr> <p>Ok, guys! Thanks for your answers. But what if use some third static number for computing key/hash. And then use it with one of the identifiers (numbers) for determining the key. N1 = 37 N2 = 8 SN3 = 999 (hardcoded) key(n1, n2) = key(n1,sn3) = key(n2,sn3)</p> <p>Also I’m thinking about keeping my identifiers in QWORD. Hash from string identifier is kept in higher DWORD and int identifier is kept in lowest DWORD. Then in methods Cache.Get I can determine type of parameter, if its int so lookup in lower DWORD and if type is string, lookup in higher DWORD. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload