> For the complete documentation index, see [llms.txt](https://close.gitbook.io/yun-wei-bi-ji/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://close.gitbook.io/yun-wei-bi-ji/python/django/django-xia-redis-cao-zuo.md).

# Django 下 redis 操作

```python
redis 常用命令-django

cache.set('key_1','value_1', 20)	result:    True
cache.get("key_1")	    			result: 'value_1'
cache.ttl('key_1')	    			result: 0表示已过期，None表示未设置过期时间	300
cache.delete('key_1')				result: 1：成功，0：失败	1
```
