redis_dumbpool

Crates.ioredis_dumbpool
lib.rsredis_dumbpool
version0.2.0
sourcesrc
created_at2021-02-18 14:04:12.58281
updated_at2021-02-19 15:28:10.668732
descriptionReally dumb implementation of a Redis Connection Pool
homepage
repositoryhttps://github.com/nappa85/redis_dumbpool
max_upload_size
id357073
size9,158
Marco Napetti (nappa85)

documentation

README

redis_dumbpool

Really dumb implementation of a Redis Connection Pool

Why another pooling crate?

My tests with other polling crates ended up with a new TIME_WAIT socket for every Redis query, like if the socket is discared and recreated every time. Trying to demonstrate the problem, I endend up with this implementation, that is kind-of usable.

How does it works?

There is a main object (Pool), storing a Vec of Redis connections. The Pool can be inited with a number of active connections. Every time a connection is requested from the pool, it's popped from the Vec and tested before being returned. If a connection isn't available and the maximum number of connections has been already reached, an async sleep is performed before retrying. On return, the connection is wrapped in a struct that only purpose is to return the connection to the pool on drop.

Commit count: 9

cargo fmt