Skip to content

Commit 7355817

Browse files
committed
removing aioredis from documentation
1 parent 1e33e25 commit 7355817

File tree

6 files changed

+586
-598
lines changed

6 files changed

+586
-598
lines changed

.github/wordlist.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ TOC
2727
ULIDs
2828
UlidPrimaryKey
2929
WSL
30-
aioredis
3130
async
3231
asyncio
3332
cls

docs/connections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Customer(HashModel):
8080
database = redis
8181
```
8282

83-
The `get_redis_connection()` function is a Redis OM helper that passes keyword arguments to either `aioredis.Redis.from_url()` or `redis.Redis.from_url()`, depending on whether you are using Redis OM in async or sync mode.
83+
The `get_redis_connection()` function is a Redis OM helper that passes keyword arguments to either `redis.asyncio.Redis.from_url()` or `redis.Redis.from_url()`, depending on whether you are using Redis OM in async or sync mode.
8484

8585
You can also manually construct a client object:
8686

docs/fastapi_integration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Let's look at an example FastAPI app that uses Redis OM.
3636
import datetime
3737
from typing import Optional
3838

39-
import aioredis
39+
import redis
4040

4141
from fastapi import FastAPI, HTTPException
4242
from starlette.requests import Request
@@ -94,7 +94,7 @@ async def get_customer(pk: str, request: Request, response: Response):
9494

9595
@app.on_event("startup")
9696
async def startup():
97-
r = aioredis.from_url(REDIS_CACHE_URL, encoding="utf8",
97+
r = redis.asyncio.from_url(REDIS_CACHE_URL, encoding="utf8",
9898
decode_responses=True)
9999
FastAPICache.init(RedisBackend(r), prefix="fastapi-cache")
100100

@@ -148,7 +148,7 @@ Here is the previous FastAPI app, but using asyncio-compatible Redis OM code:
148148
import datetime
149149
from typing import Optional
150150

151-
import aioredis
151+
import redis
152152

153153
from fastapi import FastAPI, HTTPException
154154
from starlette.requests import Request
@@ -206,7 +206,7 @@ async def get_customer(pk: str, request: Request, response: Response):
206206

207207
@app.on_event("startup")
208208
async def startup():
209-
r = aioredis.from_url(REDIS_CACHE_URL, encoding="utf8",
209+
r = redis.asyncio.from_url(REDIS_CACHE_URL, encoding="utf8",
210210
decode_responses=True)
211211
FastAPICache.init(RedisBackend(r), prefix="fastapi-cache")
212212

docs/models.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ from redis_om import HashModel
4545
class Customer(HashModel):
4646
first_name: str
4747
last_name: str
48-
48+
4949
class Meta:
5050
global_key_prefix = "customer-dashboard"
5151
```
@@ -94,15 +94,15 @@ class BaseModel(HashModel, ABC):
9494
global_key_prefix = "customer-dashboard"
9595
database = redis
9696

97-
97+
9898
class Customer(BaseModel):
9999
first_name: str
100100
last_name: str
101-
101+
102102
class Meta:
103103
database = other_redis
104104

105-
105+
106106
print(Customer.global_key_prefix)
107107
# > "customer-dashboard"
108108
```
@@ -122,11 +122,11 @@ Here is a table of the settings available in the Meta object and what they contr
122122
| global_key_prefix | A string prefix applied to every Redis key that the model manages. This could be something like your application's name. | "" |
123123
| model_key_prefix | A string prefix applied to the Redis key representing every model. For example, the Redis Hash key for a HashModel. This prefix is also added to the redisearch index created for every model with indexed fields. | "" |
124124
| primary_key_pattern | A format string producing the base string for a Redis key representing this model. This string should accept a "pk" format argument. **Note:** This is a "new style" format string, which will be called with `.format()`. | "{pk}" |
125-
| database | An aioredis.Redis or redis.Redis client instance that the model will use to communicate with Redis. | A new instance created with connections.get_redis_connection(). |
125+
| database | A redis.asyncio.Redis or redis.Redis client instance that the model will use to communicate with Redis. | A new instance created with connections.get_redis_connection(). |
126126
| primary_key_creator_cls | A class that adheres to the PrimaryKeyCreator protocol, which Redis OM will use to create a primary key for a new model instance. | UlidPrimaryKey |
127127
| index_name | The RediSearch index name to use for this model. Only used if at least one of the model's fields are marked as indexable (`index=True`). | "{global_key_prefix}:{model_key_prefix}:index" |
128128
| embedded | Whether or not this model is "embedded." Embedded models are not included in migrations that create and destroy indexes. Instead, their indexed fields are included in the index for the parent model. **Note**: Only `JsonModel` can have embedded models. | False |
129-
| encoding | The default encoding to use for strings. This encoding is given to redis-py or aioredis at the connection level. In both cases, Redis OM will decode binary strings from Redis using your chosen encoding. | "utf-8" |
129+
| encoding | The default encoding to use for strings. This encoding is given to redis-py at the connection level. In both cases, Redis OM will decode binary strings from Redis using your chosen encoding. | "utf-8" |
130130
## Configuring Pydantic
131131

132132
Every Redis OM model is also a Pydantic model, so in addition to configuring Redis OM behavior with the Meta object, you can control Pydantic configuration via the Config object within a model class.
@@ -141,7 +141,7 @@ from redis_om import HashModel
141141

142142
class Customer(HashModel):
143143
# ... Fields ...
144-
144+
145145
class Config:
146146
orm_mode = True
147147
arbitrary_types_allowed = True
@@ -177,7 +177,7 @@ So, in short, if you want to use container types, use `JsonModel`.
177177
Good news! Container types _are_ supported with `JsonModel`.
178178

179179
We will use Pydantic's JSON serialization and encoding to serialize your `JsonModel` and save it in Redis.
180-
180+
181181
### Default Values
182182

183183
Fields can have default values. You set them by assigning a value to a field.

0 commit comments

Comments
 (0)