I am new to Redis. I am having a redis set and hset. Can I use same key for set and hset? Documents say key should be unique. Is it necessary to be unique per datatype or unique per server?
Redis is an open-source, in-memory key-value data store. A key-value data store is a type of NoSQL database in which keys serve as unique identifiers for their associated values. Any given Redis instance includes a number of databases, each of which can hold many different keys of a variety of data types.
Basic Operations As a dictionary, Redis allows you to set and retrieve pairs of keys and values. Think of a “key” as a unique identifier (string, integer, etc.) and a “value” as whatever data you want to associate with that key. Values can be strings, integers, floats, booleans, binary, lists, arrays, dates, and more.
Keys in Redis are all strings, so it doesn't really matter what kind of value you pass into a client. Under-the-hood the RESP protocol is used and it will pass the value as a string to the engine. some_key is always a string, even if you pass 3 as key, it is handled as a string. This is true for every client.
The maximum allowed key size is 512 MB.
Yes - it is necessary that key names be unique as each key can store one and only one basic data structure - String, Hash, List, Set or a Sorted Set (the underlying type of Bitmaps and HLLs is a String).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With