Package redisconn is a facade for Redis connection pool.
ErrNotConfigured is returned by Get if the context has no Redis pool inside.
Get returns a Redis connection using the pool installed in the context.
May block until such connection is available. Returns an error if the context expires before that. The returned connection itself is not associated with the context and can outlive it.
The connection MUST be explicitly closed as soon as it's no longer needed, otherwise leaks and slow downs are eminent.
GetPool returns a connection pool in the context or nil if not there.
NewPool returns a new pool configured with default parameters.
"addr" is TCP "host:port" of a Redis server to connect to. No actual connection is established yet (this happens first time the pool is used).
"db" is a index of a logical DB to SELECT in the connection by default, see https://redis.io/commands/select. It can be used as a weak form of namespacing. It is easy to bypass though, so please do not depend on it for anything critical (better to setup multiple Redis instances in this case).
Doesn't use any authentication or encryption.
ReportStats reports the connection pool stats as tsmon metrics.
For best results should be called once a minute or right before tsmon flush.
"name" is used as "pool" metric field, to distinguish pools between each other.
UsePool installs a connection pool into the context, to be used by Get.