What is the key difference between traditional locking and optimistic locking in Redis?
Traditional locking blocks other clients, while optimistic locking allows concurrent access but detects conflicts.
Traditional locking is implemented with WATCH, while optimistic locking uses MULTI and EXEC.
WATCH
MULTI
EXEC
Traditional locking is used for read operations, while optimistic locking is used for write operations.
Traditional locking is only available in Redis Cluster, while optimistic locking can be used in standalone mode.
Which of the following best describes the relationship between publishers and subscribers in Redis Pub/Sub?
Many-to-one, with multiple publishers sending messages to a single subscriber.
All of the above are possible scenarios.
One-to-many, with one publisher broadcasting to multiple subscribers.
One-to-one, with each publisher dedicated to a single subscriber.
What is the role of replication in a Redis Cluster?
To improve write performance by distributing write operations.
To enhance data security by encrypting data across multiple nodes.
To provide fault tolerance and ensure data availability in case of node failures.
To optimize read operations by caching frequently accessed data on multiple nodes.
In Redis Cluster, what happens if a node holding a primary key fails?
Data on the failed node is lost permanently.
A replica of the failed node is promoted to master, ensuring data availability.
All other nodes in the cluster take over the data from the failed node.
The cluster becomes inaccessible until the failed node is restored.
In a Redis Cluster, how is data distributed across the nodes?
Data is manually partitioned by the user during setup.
Data is distributed using consistent hashing based on a key's hash slot.
Data is replicated to all nodes for high availability.
Data is randomly assigned to any node.
What is the primary advantage of using Redis HyperLogLogs over traditional sets for cardinality estimation?
HyperLogLogs support range queries on the stored elements.
HyperLogLogs allow for storing duplicate elements.
HyperLogLogs provide exact cardinality counts.
HyperLogLogs consume significantly less memory for large cardinalities.
Can you use WATCH inside a MULTI/EXEC block in Redis?
No, WATCH must be used before starting a transaction with MULTI.
Yes, you can use WATCH inside a MULTI/EXEC block to add keys to the watch list during a transaction.
Yes, but only if the keys being watched are the same as those being modified within the transaction.
No, WATCH is not compatible with transactions and must be used separately.
What is the core functionality of Redis Pub/Sub?
Guaranteeing message delivery with acknowledgments.
Executing Lua scripts for complex operations.
Storing key-value pairs persistently.
Enabling real-time one-way messaging.
What type of data structure is used internally by Redis Geospatial Indexes?
Hash
HyperLogLog
Sorted Set
Bitmap
How can Redis be used effectively with a NoSQL database like MongoDB?
As a caching layer for frequently accessed MongoDB documents.
For implementing distributed locking mechanisms for concurrent MongoDB updates.
For storing real-time metrics and counters related to MongoDB operations.
All of the above