Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bajix committed Mar 20, 2023
1 parent 7778fb5 commit fc2f490
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ Redis multiplexing with reconnection notifications and MGET auto-batching. Conne

Why use this instead of [redis::aio::ConnectionManager](https://docs.rs/redis/latest/redis/aio/struct.ConnectionManager.html)?
- Error-free reconnection behavior: when a command would otherwise fail as a consequence of the connection being dropped, this library will immediately reconnect and retry when able without producing an otherwise avoidable IoError and with subsequent reconnections debounced 1500ms
- Less contention overhead: the usage of [arc_swap::cache::Cache](https://docs.rs/arc-swap/latest/arc_swap/cache/struct.Cache.html) results in a 10-25x speed up of cached connection acquisition.
- ENV configuration makes life easier and simplifies kubernetes usage
- Reconnects can be observed, thus allowing for Redis [server-assisted client-side caching](https://redis.io/docs/manual/client-side-caching/) using client tracking redirection
- ENV configuration simplifies kubernetes usage
- Reconnects can be observed allowing for Redis [server-assisted client-side caching](https://redis.io/docs/manual/client-side-caching/) using client tracking redirection
- Integrated MGET auto-batching (up to 180x more performant than GET)

````
## ENV Configuration

Composible connection urls are provided by environment variables using [env-url](https://crates.io/crates/env-url) with the `REDIS` prefix:

```
REDIS_URL=redis://127.0.0.1:6379
# Override env mapping for easy kubernetes config
REDIS_HOST_ENV=MONOLITH_STAGE_REDIS_MASTER_PORT_6379_TCP_ADDR
REDIS_PORT_ENV=MONOLITH_STAGE_REDIS_MASTER_SERVICE_PORT_REDIS
```

## Example

```rust
use redis::{AsyncCommands, RedisResult};
use redis_swapplex::get_connection;
Expand Down
7 changes: 4 additions & 3 deletions crates/redis-swapplex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
//!
//! Why use this instead of [redis::aio::ConnectionManager](https://docs.rs/redis/latest/redis/aio/struct.ConnectionManager.html)?
//! - Error-free reconnection behavior: when a command would otherwise fail as a consequence of the connection being dropped, this library will immediately reconnect and retry when able without producing an otherwise avoidable IoError and with subsequent reconnections debounced 1500ms
//! - Less contention overhead: the usage of [arc_swap::cache::Cache](https://docs.rs/arc-swap/latest/arc_swap/cache/struct.Cache.html) results in a 10-25x speed up of cached connection acquisition.
//! - ENV configuration makes life easier and simplifies kubernetes usage
//! - Reconnects can be observed, thus allowing for Redis [server-assisted client-side caching](https://redis.io/docs/manual/client-side-caching/) using client tracking redirection
//! - ENV configuration simplifies kubernetes usage
//! - Reconnects can be observed allowing for Redis [server-assisted client-side caching](https://redis.io/docs/manual/client-side-caching/) using client tracking redirection
//! - Integrated MGET auto-batching (up to 180x more performant than GET)
//!
//! Composible connection urls are provided by environment variables using [env-url](https://crates.io/crates/env-url) with the `REDIS` prefix:
//!
//! ```text
//! REDIS_URL=redis://127.0.0.1:6379
//! # Override env mapping for easy kubernetes config
Expand Down

0 comments on commit fc2f490

Please sign in to comment.