redis中的嵌套哈希

Par*_*ena 0 ruby hash redis

我想使用散列的散列(嵌套散列)。例如,

{Key 1 -> 
  {Subkey 1 -> {Value1, Value2...}, 
    Subkey 2 -> {Value1, Value2...},
    .
    .
    Subkey n -> {Value1, Value2...}
  }
  Key 2 -> {...}
  .
  .
  Key n -> {...}
}
Run Code Online (Sandbox Code Playgroud)

告诉我如何在 redis 中定义这个结构以及如何访问这些值。我正在尝试在 ruby​​ 上使用它。

whi*_*hky 5

您不能在 redis 中使用嵌套散列,但是在您要求的那种情况下,您可以使用两种散列,一个用于键到子键,另一个用于子键到您的值。