如何使用redis与Django? [英] How can I use redis with Django?

查看:136
本文介绍了如何使用redis与Django?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过redis-cache,但它是如何工作的?它是否用作django和我的rdbms之间的层,通过以某种方式缓存rdbms查询?

I've heard of redis-cache but how exactly does it work? Is it used as a layer between django and my rdbms, by caching the rdbms queries somehow?

还是应该直接用作数据库?其中我怀疑,由于该github页面没有涵盖任何登录详细信息,没有设置..只是告诉你设置一些配置属性。

Or is it supposed to be used directly as the database? Which I doubt, since that github page doesn't cover any login details, no setup.. just tells you to set some config property.

推荐答案

Redis的这个Python模块在自述文件中有一个明确的用法示例: http://github.com / andymccurdy / redis-py

This Python module for Redis has a clear usage example in the readme: http://github.com/andymccurdy/redis-py

Redis被设计为RAM缓存。它支持基本的GET和SET键以及诸如字典之类的集合的存储。您可以通过将其输出存储在Redis中来缓存RDBMS查询。目标是加快您的Django网站。在您需要速度之前,请勿开始使用Redis或任何其他缓存 - 请勿过早优化。

Redis is designed to be a RAM cache. It supports basic GET and SET of keys plus the storing of collections such as dictionaries. You can cache RDBMS queries by storing their output in Redis. The goal would be to speed up your Django site. Don't start using Redis or any other cache until you need the speed - don't prematurely optimize.

这篇关于如何使用redis与Django?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆