SncRedisBundle is not working, what am I doing wrong?
snc_redis:
clients:
default:
type: predis
alias: default
dsn: redis://localhost
session:
client: session
prefix: session_
use_as_default: true
The above is my current snc_redis configuration in config.yml I added a specific snc_redis as a session handler id by doing the following:
framework:
...
session:
handler_id: snc_redis.session.handler
The error I am getting:
The service definition "snc_redis.session_client" does not exist.
and when i remove the line client: session
it still fails:
The child node "client" at path "snc_redis.session" must be configured.
source to share
In your config.yml file try adding this:
# config.yml
snc_redis:
clients:
default:
type: predis
alias: default
dsn: redis://%redis_address%
logging: %kernel.debug%
session:
type: predis
alias: session
dsn: redis://%redis_address%/1
logging: true
session:
client: session
prefix: %project_name%
This will install 2 clients, default and cache. You can use default to handle data caching and session
to handle session stuff. If you only have 1 shard, you can simply remove the session client ( snc_redis.clients.session
) and then set snc_redis.session.client
todefault
For the framework part, try this:
framework:
...
session: ~
The SncRedisBundle will then manage sessions for you based on the first configuration. The second configuration simply tells Symfony that you are not defaulting.
Tell me if it works or not and I'll edit accordingly :)
source to share