iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
Manage Redis safely by selecting the intended logical database, counting and scanning keys without blocking the server, applying and checking expiration, deleting only the required scope, restricting destructive commands with ACLs, and choosing an eviction policy that matches your data-loss tolerance. The command line is the most precise method; Redis Insight can help you explore structures visually, but production changes still need change control.
How Redis databases and keys are organized
Redis stores every object under a unique key. A Redis server can expose multiple logical databases, each acting as a separate key namespace on that server. A client connection has one selected database at a time, and commands such as DBSIZE, SCAN, FLUSHDB and ordinary key operations apply to that selected database.
Recommended Free Tools
Logical databases are not separate Redis servers. They share the same process, memory limit, persistence configuration and operational failure domain. Use them for clear namespaces or small operational separations, not as a substitute for tenant isolation when users must be prevented from affecting one another. ACL key patterns can limit access to matching keys, but they do not automatically constrain commands that operate on an entire database.
Select the right database before inspecting or changing data
Always establish the connection and database index before running an administrative command. A connection may begin on the default database, but pooled clients can retain whichever database a previous operation selected.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
- Connect with your normal Redis client or CLI.
- Run
SELECT 2(replace2with the intended zero-based database index). - Confirm the selected database with your connection workflow, then run
DBSIZEto see how many keys it contains.
SELECT 2
DBSIZE
SELECT changes the database for that connection. DBSIZE reports the number of keys in the currently selected database, not the total across the server. In application code, set the database explicitly when a connection is created or checked out of a pool; otherwise a prior SELECT can send a command to the wrong namespace.
When logical databases are the wrong boundary
Because logical databases share resources and whole-database commands can cross key-pattern restrictions, use separate Redis deployments when you need stronger isolation, independent memory limits, separate maintenance windows or independent availability. Keep the logical-database index in configuration and in runbooks so an operator cannot confuse a development namespace with production data.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteCount and inspect keys without blocking Redis
Use DBSIZE for a fast count
Run DBSIZE after selecting the target database to obtain its key count. It answers “how many keys are in this database?” but does not show names, types, sizes or expiration state.
Use SCAN for incremental keyspace inspection
SCAN iterates with a cursor so the server can return batches instead of attempting to materialize the entire keyspace in one response. A typical inspection starts at cursor 0:
SCAN 0 MATCH user:* COUNT 100
The response contains a new cursor and a batch of matching keys. Call SCAN again with that cursor, retaining the same pattern and count, until the returned cursor is 0. The COUNT value is a batch-size hint, not a guarantee that exactly that many keys will be returned.
For an audit script, record the database index, pattern, start time and final cursor. If the script performs a follow-up action such as deletion, make that action idempotent and verify the key still matches your intended rule before removing it.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Why KEYS is risky
KEYS pattern asks Redis to return all matching keys in one operation. Redis documentation warns that KEYS blocks the server until all keys are returned. On a large or busy production database, that pause can delay unrelated commands and cause request timeouts. Reserve it for a controlled, very small dataset or an emergency diagnostic where the blocking effect has been explicitly accepted. Prefer SCAN for routine discovery, monitoring and automation.
Inspect values only after narrowing the key set
Once a key is identified, use type-appropriate commands such as TYPE, GET, HGETALL, SMEMBERS, LRANGE or XRANGE. Avoid fetching large collections indiscriminately. For destructive maintenance, first export or log the key names and counts needed for approval, then process them in bounded batches.
Set, check and remove key expiration
A time to live (TTL) lets Redis remove a key automatically after a deadline. Expiration can be expressed in seconds or milliseconds, and Redis expiration resolution is one millisecond. Expiration metadata is replicated and persisted as an absolute timestamp, so failover or restart does not turn a one-hour TTL into an extra hour.
Set expiration when creating a key
SET session:123 abc EX 3600
This stores the value and assigns a 3,600-second lifetime in one operation. Setting the lifetime with the write avoids a window in which the key exists without an expiry.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Change an existing lifetime
EXPIRE session:123 600
PEXPIRE session:123 600000
EXPIRE accepts seconds; PEXPIRE accepts milliseconds. Choose one unit consistently in application code and document the unit in configuration. A later expiration command replaces the previous deadline.
Inspect remaining lifetime
TTL session:123
PTTL session:123
TTL returns remaining time in seconds and PTTL in milliseconds. A positive result is the remaining lifetime; a negative result indicates either that the key has no expiration or that it does not exist. Check key existence and application state before treating a negative result as a configuration error.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Make a key persistent
PERSIST session:123
PERSIST removes the expiration while leaving the value in place. Use it deliberately: converting a temporary session, cache entry or lock into a persistent key can increase memory use and change eviction behavior.
Expiration design checks
- Give sessions, locks, rate-limit counters and cache entries an explicit lifetime appropriate to their function.
- Do not use expiration as the only protection for data that must never be lost; an eviction policy can still remove expiring keys before their deadline under memory pressure.
- When extending a TTL, verify that the operation is authorized and that the key still belongs to the same logical owner.
- Monitor the population of keys without expiration so accidental persistent writes are visible before memory pressure occurs.
Delete keys at the smallest safe scope
Delete selected keys
Use DEL when you need synchronous removal of named keys. For large values, UNLINK can detach keys and perform memory reclamation asynchronously, reducing the time spent in the command path. Confirm that asynchronous cleanup is acceptable for your operational procedure and memory headroom.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear the selected logical database
FLUSHDB ASYNC
FLUSHDB removes every key in the currently selected database. The command reference classifies its work as O(N), where N is the number of keys in that database. The ASYNC option schedules memory cleanup in the background, but the logical data removal is still a complete database reset. Before running it, print or otherwise verify the selected database and capture a key count with DBSIZE.
Clear every logical database
FLUSHALL ASYNC
FLUSHALL removes all keys from all logical databases. Its O(N) work is based on the total number of keys on the server, not just the current database. Redis classifies this command as dangerous, and its documentation notes that it can clear the RDB persistence file. Treat it as an incident-level operation: require explicit approval, verify the server identity, stop writers where possible, and confirm backups and recovery steps before execution.
A deletion checklist
- Identify the host, environment and selected database.
- Define the intended scope: named keys, a pattern, one database or every database.
- Use
SCANto preview matching keys and record the count. - Check key types and expiration where deletion could affect active sessions, locks or queues.
- Obtain the required change approval and confirm a recoverable backup or replica position.
- Delete in bounded batches with
DELorUNLINK, or run the approved flush command. - Re-run
DBSIZEor a controlledSCANto verify the result and monitor latency and memory.
Protect operators and tenants with ACLs
Redis ACLs limit which commands a connection can execute and which key patterns it can access. A key pattern such as ~tenant1:* is useful for ordinary key commands, but it does not constrain commands that operate on an entire database. In particular, FLUSHALL, FLUSHDB and SWAPDB can bypass a user’s key-pattern boundary.
Create tenant-scoped users with only the permissions they need, and explicitly remove whole-database commands when they are not part of the role:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
ACL SETUSER tenant1 on >strong-password ~tenant1:* +@all -flushall -flushdb -swapdb
The example enables the user, sets a password, permits keys matching tenant1:*, grants command categories and then denies the three database-wide operations. Replace the password and command categories with your own least-privilege policy; +@all is intentionally broad and should be narrowed for a production tenant role.
Separate application and administration identities
- Application users should have only the data commands required by the service.
- Maintenance users may receive scanning, TTL and deletion permissions only during an approved window.
- Break-glass administrators should be rare, strongly authenticated and audited.
- Test ACLs against both allowed key commands and forbidden whole-database commands before rollout.
ACLs reduce accidental or unauthorized changes, but they do not replace network controls, authentication hygiene, backups or a reviewed change process.
Choose an eviction policy that matches your data
When Redis reaches its configured memory limit, the eviction policy determines whether Redis removes keys or rejects writes. The correct policy depends on whether losing non-expiring data is acceptable.
| Policy family | Available policies | What may be evicted | Use when |
|---|---|---|---|
| All-keys | allkeys-lru, allkeys-lfu, allkeys-random |
Any key in the database | Every key is disposable cache-like data, and Redis should continue accepting writes by removing older, less-used or random keys. |
| Volatile | volatile-lru, volatile-lfu, volatile-random, volatile-ttl |
Only keys that have an expiration | Persistent keys must be retained while expiring keys are acceptable eviction candidates. |
| No eviction | no eviction |
No keys are removed automatically | Writes must fail rather than deleting data; the service must handle out-of-memory write errors and provision sufficient capacity. |
How to decide
- Classify every dataset as disposable, recoverable cache, expiring operational state or authoritative data.
- If any key can be removed safely, consider an
allkeys-*policy and choose LRU, LFU or random behavior according to access patterns. - If only keys with explicit TTLs are disposable, choose a
volatile-*policy and verify that all eligible data really has an expiration. - If deletion would violate correctness, choose
no eviction, set alerts below the limit and make write failures part of the application’s recovery design. - Size memory for normal peaks, replication overhead and maintenance operations; an eviction policy is not a substitute for capacity planning.
A volatile policy does not protect important keys merely because you intended them to be permanent: it protects them only when they have no expiration. Conversely, an all-keys policy can remove a non-expiring key, so do not use it for authoritative records.
CLI, automation and Redis Insight: which workflow fits?
| Approach | Strength | Main risk or limitation | Best use |
|---|---|---|---|
| Redis CLI | Exact commands, scripting and easy capture of output | A mistyped database or destructive command has immediate effect | Approved diagnostics, repeatable maintenance and incident response. |
| Scripted workflow | Can scan, validate, batch and log operations consistently | Logic errors can repeat at scale | Routine cleanup, TTL audits and controlled key migrations. |
| Redis Insight | Official GUI for browsing, filtering, visualizing and CRUD operations across strings, lists, hashes, sets, sorted sets, streams, JSON and other supported structures | Visual convenience can encourage broad manual edits; production changes still need approval and auditability | Exploration, learning data shapes and carefully inspecting individual records. |
For a GUI session, verify the connection and database shown by the interface before browsing or deleting. Use the same smallest-scope principle as the CLI, and record who made a production change, what was changed and why.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Safe operational recipes
Find keys for one application namespace
SELECT 2
SCAN 0 MATCH app:* COUNT 100
Repeat with each returned cursor until it reaches 0. Count and review the results before touching values.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Remove expired-data buildup without blocking
- Select the intended database.
- Scan a narrowly defined prefix.
- For each candidate, inspect
TTLorPTTLand confirm its type. - Delete only keys that meet the documented cleanup rule, using bounded batches.
- Monitor latency and memory while the job runs.
Reset a disposable test database
SELECT 5
DBSIZE
FLUSHDB ASYNC
DBSIZE
Use this only when database 5 is confirmed to be disposable. If the environment contains multiple teams or services, prefer deleting a dedicated test deployment rather than relying on a shared logical index.
Recover from an accidental flush
Stop further writes if possible, preserve logs and the exact command output, and determine whether replication, snapshots or another approved backup contains the required data. Because a full flush can affect persistence files and every logical database, recovery depends on your configured durability and replica history; do not assume that restarting Redis will restore deleted keys.
Free tools Windows power users keep installed
One-click scans. No signup required.
Troubleshooting common management mistakes
The key count is unexpectedly zero
- Check that the connection points to the expected host and environment.
- Run
SELECTexplicitly; you may be viewing a different logical database. - Confirm that the application uses the same database index and key prefix.
- Check whether an expiration removed the key or an eviction policy removed it under memory pressure.
SCAN appears not to return everything
Continue until the server returns cursor 0; one call is only a batch. Keep the pattern and cursor sequence consistent, and avoid changing the keyspace dramatically during an audit. For a deletion job, verify each key immediately before removal.
Writes fail when memory is high
Inspect the configured memory limit and eviction policy. Under no eviction, rejected writes are expected once the limit is reached. Under a volatile policy, keys without TTLs are not eviction candidates, so memory can still become exhausted if expiring keys are scarce. Reduce data, correct accidental persistent keys, add capacity or deliberately select an eviction policy that permits loss of disposable data.
A tenant can still affect other data
Review ACL command permissions, not only key patterns. Remove FLUSHALL, FLUSHDB and SWAPDB unless the role truly needs them, and test the policy with the same connection identity used by the tenant service.
Quick Recap
Management decision guide
| Need | Preferred operation | Why |
|---|---|---|
| Know how many keys are in one namespace | SELECT then DBSIZE |
Reports the selected logical database without enumerating names. |
| Find keys by prefix on a live server | SCAN with MATCH and a bounded COUNT |
Incremental inspection avoids the server-wide blocking behavior of KEYS. |
| Make a session expire | SET ... EX or EXPIRE |
Sets a seconds-based deadline; use PEXPIRE for milliseconds. |
| Check whether data is temporary | TTL or PTTL |
Shows remaining lifetime in the chosen unit. |
| Remove one large value with less command-path work | UNLINK |
Detaches the key and performs reclamation asynchronously. |
| Reset one disposable database | FLUSHDB ASYNC |
Scope is the currently selected database. |
| Reset the entire server | FLUSHALL ASYNC |
Scope is every logical database; requires the highest level of approval. |
| Prevent automatic deletion of important records | no eviction plus capacity planning |
Writes fail instead of removing keys. |
Operational principles to keep
- Select and verify the database before every administrative session.
- Use
SCAN, not routineKEYS, on production keyspaces. - Attach expiration at write time when data is temporary, and monitor keys that unexpectedly lack TTLs.
- Prefer the narrowest deletion scope and treat
FLUSHALLas a dangerous, recoverability-sensitive operation. - Use ACLs to deny whole-database commands for tenant-scoped users; key patterns alone are insufficient.
- Choose eviction behavior from the business consequence of losing a key, not simply from Redis memory usage.
- Use Redis Insight for visibility, but retain the approvals, logging and verification expected for production changes.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

