Trying to set a hash data type, that contains a dynamic key name. I have a attribute for example called “event_id” which contains an integer. I’d like that to be apart of the hash key name.
self.attributes.each do |field, value|
$redis.hset(event_id, field, value)
end
end
With the current code above, the key in redis is looking like
32434
The goal is that I can add some text in front of that key, so that ideally the key would look like
this:is:the:event_id:32434
I can’t fiqure out the syntax in the key args without breaking the syntax. Thanks
I fiqured this out by creating a “redis namespace”. Then instead of doing $redis, which is the general namespace, I will call on this new namespace for the correct key name I’m after. The namespaces are nice way to organize your redis data.