<commit_before># Pottery: Redis for Humans 🌎🌍🌏

[Redis](http://redis.io/) is awesome, but [Redis
commands](http://redis.io/commands) are not always fun.  Pottery is a Pythonic
way to access Redis.  If you know how to use Python dicts, then you already
know how to use Pottery.

[![Build status](https://img.shields.io/github/workflow/status/brainix/pottery/Python%20package/master)](https://github.com/brainix/pottery/actions?query=branch%3Amaster)
![Dependencies up to date](https://img.shields.io/librariesio/github/brainix/pottery)
[![Latest released version](https://badge.fury.io/py/pottery.svg)](https://badge.fury.io/py/pottery)

![Supported Python versions](https://img.shields.io/pypi/pyversions/pottery)
![Number of lines of code](https://img.shields.io/tokei/lines/github/brainix/pottery)

[![Total number of downloads](https://pepy.tech/badge/pottery)](https://pepy.tech/project/pottery)
[![Downloads per month](https://pepy.tech/badge/pottery/month)](https://pepy.tech/project/pottery)
[![Downloads per week](https://pepy.tech/badge/pottery/week)](https://pepy.tech/project/pottery)



## Table of Contents
- [Dicts 📖](#dicts)
- [Sets 🛍️](#sets)
- [Lists ⛓](#lists)
- [Counters 🧮](#counters)
- [Deques 🖇️](#deques)
- [Redlock 🔒](#redlock)
    - [synchronize() 👯‍♀️](#synchronize)
- [NextId 🔢](#nextid)
- [redis_cache()](#redis_cache)
- [CachedOrderedDict](#cachedordereddict)
- [Bloom filters](#bloom-filters)
- [HyperLogLogs](#hyperloglogs)
- [ContextTimer ⏱️](#contexttimer)



## Installation

```shell
$ pip3 install pottery
```

## Usage

First, set up your Redis client:

```python
>>> from redis import Redis
>>> redis = Redis.from_url('redis://localhost:6379/1')
>>>
```



## Dicts 📖

`RedisDict` is a Redis-backed container compatible with Python&rsquo;s
[`dict`](https://docs.python.org/3/tutorial/datastructures.html#dictionaries).

Here is a small example using a `RedisDict`:

```python
>>> from pottery import RedisDict<commit_msg>Fix link anchor targets in Table of Contents (#362)<commit_after># Pottery: Redis for Humans 🌎🌍🌏

[Redis](http://redis.io/) is awesome, but [Redis
commands](http://redis.io/commands) are not always fun.  Pottery is a Pythonic
way to access Redis.  If you know how to use Python dicts, then you already
know how to use Pottery.

[![Build status](https://img.shields.io/github/workflow/status/brainix/pottery/Python%20package/master)](https://github.com/brainix/pottery/actions?query=branch%3Amaster)
![Dependencies up to date](https://img.shields.io/librariesio/github/brainix/pottery)
[![Latest released version](https://badge.fury.io/py/pottery.svg)](https://badge.fury.io/py/pottery)

![Supported Python versions](https://img.shields.io/pypi/pyversions/pottery)
![Number of lines of code](https://img.shields.io/tokei/lines/github/brainix/pottery)

[![Total number of downloads](https://pepy.tech/badge/pottery)](https://pepy.tech/project/pottery)
[![Downloads per month](https://pepy.tech/badge/pottery/month)](https://pepy.tech/project/pottery)
[![Downloads per week](https://pepy.tech/badge/pottery/week)](https://pepy.tech/project/pottery)



## Table of Contents
- [Dicts 📖](#dicts-)
- [Sets 🛍️](#sets-%EF%B8%8F)
- [Lists ⛓](#lists-)
- [Counters 🧮](#counters-)
- [Deques 🖇️](#deques-%EF%B8%8F)
- [Redlock 🔒](#redlock-)
    - [synchronize() 👯‍♀️](#synchronize-%EF%B8%8F)
- [NextId 🔢](#nextid-)
- [redis_cache()](#redis_cache)
- [CachedOrderedDict](#cachedordereddict)
- [Bloom filters](#bloom-filters)
- [HyperLogLogs](#hyperloglogs)
- [ContextTimer ⏱️](#contexttimer-%EF%B8%8F)



## Installation

```shell
$ pip3 install pottery
```

## Usage

First, set up your Redis client:

```python
>>> from redis import Redis
>>> redis = Redis.from_url('redis://localhost:6379/1')
>>>
```



## Dicts 📖

`RedisDict` is a Redis-backed container compatible with Python&rsquo;s
[`dict`](https://docs.python.org/3/tutorial/datastructures.html#dictionaries).

Here is a small example using a `RedisDict`:

```python
>>> from pottery import RedisDict
{'fraction_non_alphanumeric': 0.1894526368407898, 'fraction_numerical': 0.007748062984253936, 'mean_word_length': 5.253125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 28, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2417566', 'n_tokens_mistral': 1617, 'n_tokens_neox': 1487, 'n_words': 279}