Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/getsentry/rb
Routing and connection management for Redis in Python
https://github.com/getsentry/rb
tag-production
Last synced: 3 months ago
JSON representation
Routing and connection management for Redis in Python
- Host: GitHub
- URL: https://github.com/getsentry/rb
- Owner: getsentry
- License: apache-2.0
- Created: 2015-08-13T18:42:51.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-02-26T21:14:19.000Z (8 months ago)
- Last Synced: 2024-07-18T23:01:25.582Z (4 months ago)
- Topics: tag-production
- Language: Python
- Homepage: http://rb.readthedocs.org/en/latest/
- Size: 346 KB
- Stars: 301
- Watchers: 68
- Forks: 33
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES
- License: LICENSE
Awesome Lists containing this project
README
# rb [![test](https://github.com/getsentry/rb/actions/workflows/test.yml/badge.svg)](https://github.com/getsentry/rb/actions/workflows/test.yml)
![logo](https://github.com/getsentry/rb/blob/master/docs/_static/rb.png?raw=true)
rb - the redis blaster.
The fastest way to talk to many redis nodes. Can do routing as well as
blindly blasting commands to many nodes. How does it work?For full documentation see [rb.rtfd.org](http://rb.rtfd.org/)
## Quickstart
Set up a cluster:
```python
from rb import Clustercluster = Cluster({
0: {'port': 6379},
1: {'port': 6380},
2: {'port': 6381},
3: {'port': 6382},
}, host_defaults={
'host': '127.0.0.1',
})
```Automatic routing:
```python
results = []
with cluster.map() as client:
for key in range(100):
client.get(key).then(lambda x: results.append(int(x or 0)))print('Sum: %s' % sum(results))
```Fanout:
```python
with cluster.fanout(hosts=[0, 1, 2, 3]) as client:
infos = client.info()
```Fanout to all:
```python
with cluster.fanout(hosts='all') as client:
client.flushdb()
```