This class can be instantiated by passing in the Redis connection and base name. After that it works the same as ConditionalFreqDist as shown in the code below:
0  1 1 [’cond1’]
How does this work?
- RedisConditionalHashFreqDist uses name prefixes to refer to instances of RedisHashFreqDist.
- The name passed to RedisConditionalHashFreqDist is the base name which is combined with each condition to create a unique name for each RedisHashFreqDist .
- For example, if the base name is RedisConditionalHashFreqDist — "condhash" and the condition — "Cond1" then the final name of RedisHashFreqDist — "condhash: cond1" .
- This naming pattern is used during initialization to find all existing hash maps using the keys command.
- When searching for all keys, matching & # 39; condhash: * & # 39 ;, the user can identify all existing conditions and instantiate RedisHashFreqDist for each.
- Colon string concatenation is a common naming convention for Redis keys as a way to define spaces names.
- Each instance of RedisConditionalHashFreqDist defines one hash card namespace.
RedisConditionalHashFreqDist also defines a clear () method. This is a helper method that calls clear () on all internal RedisHashFreqDist instances. The clear () method is not defined in ConditionalFreqDist .