Redis allows setting a maxmemory limit. What happens if you do not configure maxmemory in a Redis instance?
Think about what happens when a program uses more memory than the system has.
If maxmemory is not set, Redis can consume all available RAM, which may cause the system to become unstable or crash. Setting maxmemory helps control memory usage.
After running CONFIG SET maxmemory 1048576 in Redis, what will CONFIG GET maxmemory return?
CONFIG SET maxmemory 1048576
CONFIG GET maxmemoryRemember Redis stores memory sizes in bytes internally.
Redis stores maxmemory as bytes. Setting it to 1048576 means 1MB. The CONFIG GET command returns the setting as a two-element array: the name and the value as a string.
Choose the correct Redis command to set the eviction policy to allkeys-lru.
Redis configuration keys use hyphens, not underscores or spaces.
The correct syntax uses the exact configuration key name maxmemory-policy without spaces or underscores. Quotes or equals signs are not used in Redis commands.
If Redis is configured with maxmemory-policy volatile-lru, what happens when memory limit is reached?
Consider what 'volatile' means in Redis eviction policies.
The 'volatile-lru' policy evicts only keys that have an expiration set, choosing the least recently used among them. Keys without expiration are never evicted under this policy.
In some Redis versions, running CONFIG SET maxmemory 0 causes an error. Why?
Check Redis documentation on valid maxmemory values.
Redis requires maxmemory to be a positive integer or -1 to disable the limit. Setting it to 0 is invalid and causes an error in some versions.