- How do I install SncRedisBundle for Symfony 6.4+?
- Run `composer require snc/redis-bundle` and enable the bundle in `config/bundles.php`. Basic configuration is added via `config/packages/snc_redis.yaml`. The bundle auto-detects PhpRedis (preferred) or falls back to Predis.
- Which Redis client does SncRedisBundle use by default?
- The bundle prioritizes the native **PhpRedis extension** for performance. If unavailable, it automatically switches to **Predis** (pure PHP) with identical functionality. Predis is ~20-30% slower but works in restricted environments.
- Can I use SncRedisBundle with Symfony Messenger for queues?
- Yes, the bundle integrates with **Symfony Messenger** via **Relay** (Redis-based transport). Configure it in `config/packages/messenger.yaml` under `transports` with `dsn: 'redis://...'`. Ensure your Redis client (PhpRedis/Predis) supports pub/sub.
- Does SncRedisBundle support Redis Cluster or Sentinel?
- Yes, both are supported. Configure them in `snc_redis.yaml` under `clients` with `type: cluster` or `sentinel`. Start with a single instance in development, then test failover in staging. Monitor connection stability with Symfony’s Stopwatch.
- What’s the recommended setup for production performance?
- Use **PhpRedis** (native extension) for maximum speed. Disable debug logging, enable persistent connections (`persistent: true`), and pin Predis to `^2.0` in `composer.json`. Benchmark with `redis-benchmark` to validate throughput.
- How do I configure multiple Redis instances (e.g., dev/staging/prod)?
- Define separate clients in `snc_redis.yaml` under `clients` with unique names (e.g., `dev`, `prod`). Use environment variables (`%env(REDIS_DSN)%`) or Symfony’s parameter bag to switch between them dynamically.
- Is SncRedisBundle compatible with Symfony 7.0+?
- Yes, the bundle supports **Symfony 6.4+ and 7.0+** (v4.11+). For early Symfony 8/8.5 support, use the RC version (`^4.11@rc`). Check `UPGRADE.md` for breaking changes if migrating from older versions.
- Can I use SncRedisBundle for Symfony Cache (RedisAdapter)?
- Absolutely. Configure the `RedisAdapter` in `config/packages/cache.yaml` with `provider: snc_redis.cache` (or your client name). The bundle provides a unified interface for caching, aligning with Symfony’s Cache component.
- What alternatives exist to SncRedisBundle for Symfony Redis?
- Alternatives include **Kdyby/Redis** (flexible but less Symfony-native) and **Symfony’s built-in Redis Messenger transport** (limited to queues). SncRedisBundle stands out for its **Symfony DI integration**, **dual-client support**, and **Cluster/Sentinel** features.
- How do I debug connection issues with SncRedisBundle?
- Enable debug logging in `snc_redis.yaml` (`logging: true`) to trace commands. Use Symfony’s profiler to monitor Redis latency. For PhpRedis issues, verify the extension is loaded (`php -m | grep redis`). Test connectivity with `redis-cli ping` in your environment.