BotBlocker uses caching to accelerate resource-intensive security checks: PTR lookups, DNSBL checks, bot database queries, and cloud-based threat analysis. Two classic caching systems are supported—Redis and Memcached—but only one can be active at a time. Here’s a practical comparison focused on WordPress security and BotBlocker’s real-world needs.
Key Similarities
- Both are ultra-fast, in-memory key-value stores.
- Both reduce load on MySQL, DNS, cloud APIs, and cut security check times from hundreds of ms to a few ms.
- Both are supported by PHP and all major hosting panels.
- BotBlocker can use either Redis or Memcached for storing cached verdicts on visitor checks (PTR, DNSBL, bot databases, cloud results).
Redis: Pros and Cons
Advantages:
- Supports advanced data types: hashes, sets, sorted sets (useful for future analytics or complex data).
- Offers persistence: can save data to disk for recovery after restarts (Memcached stores data only in RAM).
- Better suited for atomic operations and “expiring” logic.
- Flexible TTL and more granular key management.
- Widely used for session storage, queues, pub/sub, analytics.
Disadvantages:
- Slightly higher memory overhead per object (vs. Memcached).
- More complex to set up advanced features.
- Slower for pure “get/set” under extreme, simple workloads (though usually negligible).
Memcached: Pros and Cons
Advantages:
- Very simple: pure key-value, extremely fast at single get/set operations.
- Minimal memory overhead.
- Trivial to set up and scale horizontally (clusters).
- Works well as a drop-in cache for classic setups.
Disadvantages:
- No data persistence: all cache lost after restart.
- Lacks advanced data structures (no lists, hashes, sets).
- No built-in support for atomic counters, pub/sub, or complex expiry logic.
BotBlocker: Why Only One Cache Backend?
- BotBlocker uses cache to instantly store and retrieve check results for IPs, PTR, DNSBL, bot fingerprints, and cloud queries.
- Due to architectural simplicity and reliability, only one backend (Redis or Memcached) can be active at a time—this prevents key conflicts, sync issues, and redundancy.
- Choice is made in plugin or server configuration.
Switching requires clearing the cache and restarting the service for consistent operation.
When to Choose Redis for BotBlocker
- You want advanced features (future-proof): data persistence, custom TTL, analytics, pub/sub, or plan to use Redis for other WordPress features (object cache, sessions).
- You expect heavy concurrent load and need atomic operations or more complex cache logic.
- You prefer a single backend for both security and app data (Redis is often used for everything).
When to Choose Memcached for BotBlocker
- You need raw speed and simplicity, with no need for data persistence or complex cache logic.
- You already use Memcached for object cache and want a unified, minimal setup.
- Your hosting provides only Memcached or it’s easier to manage for your team.
Real-World Considerations
- Both provide instant cache hits for security checks.
- Redis is slightly more flexible and robust for future development and big data needs.
- Memcached is lighter, often a bit faster for trivial workloads, and very easy to run on small/medium servers.
FAQ
Can I use both Redis and Memcached at the same time with BotBlocker?
No—BotBlocker uses only one cache backend at a time. Mixing would cause data inconsistency.
Which is safer?
Both are secure when properly configured (local socket or authenticated access). Redis can offer persistence, which may matter for forensics.
What if my host supports both?
If you have the choice—prefer Redis for flexibility, or Memcached for pure simplicity and legacy compatibility.
Redis Official | Memcached Official
Internal Links (EN):