An open API service indexing awesome lists of open source software.

https://github.com/answerdotai/tinyredis

Experimental minimalist API for redis
https://github.com/answerdotai/tinyredis

Last synced: 4 days ago
JSON representation

Experimental minimalist API for redis

Awesome Lists containing this project

README

        

# tinyredis

> *Experimental minimalist API for redis*

pip install tinyredis

## Sample

```python
import redis
from tinyredis import TinyRedis
from dataclasses import dataclass

@dataclass
class Todo: id:int; title:str; done:bool=False

todos = TinyRedis(redis.from_url(YOUR_URL), Todo)

todo = todos.insert(Todo(1, "Create README example"))
# or: todo = todos.insert(title="Create README example")
# if you don't pass `id`, a uuid4 id will be created for you
print(todos()) # Prints all todos
todo.done = True
todos.update(todo)
print(todos[todo.id])
todos.delete(todo.id)
```