Skip to content

Commit 93aa9f7

Browse files
author
Simon Prickett
committed
Updated docs with expire.
1 parent b42e636 commit 93aa9f7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ print(andrew.pk)
119119
# We can save the model to Redis by calling `save()`:
120120
andrew.save()
121121

122+
# Expire the model after 2 mins (120 seconds)
123+
andrew.expire(120)
124+
122125
# To retrieve this customer with its primary key, we use `Customer.get()`:
123126
assert Customer.get(andrew.pk) == andrew
124127
```

docs/getting_started.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,15 @@ andrew = Customer(
553553
andrew.save()
554554
```
555555

556+
## Expiring Models
557+
558+
We can expire an instance of a model using `expire`, and passing it the number of seconds after which we want the instance to expire in Redis:
559+
560+
```python
561+
# Expire Andrew in 2 minutes (120 seconds)
562+
andrew.expire(120)
563+
```
564+
556565
## Examining Your Data In Redis
557566

558567
You can view the data stored in Redis for any Redis OM model.

0 commit comments

Comments
 (0)