Sandbox adapter for Redis via Redix.
Isolates each test by giving it a dedicated Redis database number. A pool of Redix connections (each on a different DB) is created at setup. On checkout, the test gets a clean connection; on checkin, the DB is flushed and returned to the pool.
Configuration
config :sandbox_case,
sandbox: [
redis: [url: "redis://localhost:6379", pool_size: 8]
]Accessing the connection
In your app code, read the sandboxed connection from the process dictionary with a fallback to your default connection:
def redis_conn do
Process.get(:redis_sandbox) || MyApp.Redis.default_conn()
end
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.