Redis is an in-memory key-value pair database typically classified as a NoSQL database. Redis is commonly used for caching, transient data storage and as a holding area for data during analysis in Python applications.

Redis logo.

Redis is an implementation of the NoSQL database concept. Learn more in the data chapter or view the table of contents for all topics.

Redis tutorials

Redis is easy to install and start using compared to most other persistent backends, but it's useful to follow a walkthrough if you have never previously used Redis or any NoSQL data store.

Redis with Python

Redis is easier to use with Python if you have a code library client that bridges from your code to your Redis instace. The following libraries and resources provide more information on handling data in a Redis instance with your Python code.

  • Redis-py is a solid Python client to use with Redis.

  • Walrus is a higher-level Python wrapper for Redis with some caching, querying and data structure components build into the library.

  • Writing Redis in Python with Asyncio shows a detailed example for how to use the new Asyncio standard library in Python 3.4+ for working with Redis. There is also a EuroPython video of the talk that goes along with the code.

  • Cache_deco is a generic Python caching decorator library.

  • Write your own miniature Redis with Python doesn't actually use Redis but shows how you can write a simplified version of Redis' in-memory data store with Python. It's a good article to understand more about how NoSQL data stores can work under the covers.

Redis examples

Redis' wide applicability can be a downside if you don't know what to start using it for in your application. The following code and posts provide common use cases for Redis.

  • redis-labs-use-cases has a couple of examples of using Redis to analyze geospatial data and tweets.

  • redis-migrate-tool is a library to make it easier to move data between redis clusters and groups.

Redis Security

Redis should be customized out of its default configuration to secure it against unauthorized and unauthenticated users. These resources provide some advice on Reids security and guarding against data breaches.

  • Pentesting Redis servers shows that security is important not only on your application but also the databases you're using as well.

  • Redis, just as with any relational or NoSQL database, needs to be secured based on security guidelines. There is also a post where the main author of Redis cracks its security to show the tradeoffs purposely made between ease of use and security in the default settings.

  • For God’s sake, secure your Mongo/Redis/etc! digs into the unfortunate default security settings that come with many NoSQL databases which can be used to compromise your systems. Make sure to not only install your dependencies such as Redis, but automate modifying default settings to lock them down against attackers.

Specific Redis topics

Once you have configured Redis, become comfortable using it and locked it down against malicious actors, you will want to learn more about operating, scaling and collecting metrics. The following resources should help you get started in those areas.

What do you want to learn about next?

Tell me about standard relational databases.

I've built a Python web app, now how do I deploy it?

I want to learn how to code a Python web application using a framework.

Sign up for two emails per month with Python tutorials and Full Stack Python updates.

Sponsored By

Mapbox logo.

Easily build maps, search and navigation into your Python applications with Mapbox.

Full Stack Python

Full Stack Python is an open book that explains concepts in plain language and provides helpful resources for those topics.
Updates via newsletter, Twitter & Facebook.
1. IntroductionLearning ProgrammingCore LanguageWhy Use Python?Python 2 or 3?Enterprise PythonPython CommunityCompanies using PythonBest Python ResourcesBest Python VideosBest Python Podcasts2. Development EnvironmentsText Editors & IDEsVimEmacsSublime TextPyCharmJupyter NotebookShellsBash shellZshPowerShellTerminal MultiplexerstmuxScreenPymuxEnvironment configurationApplication DependenciesVirtualenvsEnvironment variablesLocalhost tunnelsSource ControlGitMercurialApache SubversionHosted Source ControlGitHubBitBucketGitLab3. DataRelational DatabasesPostgreSQLMySQLSQLiteObject-relational MappersSQLAlchemyPeeweeDjango ORMSQLObjectPony ORMNoSQL Data StoresRedisMongoDBApache CassandraNeo4jData analysispandasNumPySciPyBokehd3.jsMatplotlibMarkdown4. Web DevelopmentWeb FrameworksDjangoFlaskBottlePyramidFalconMorepathSanicOther Web FrameworksTemplate EnginesJinja2MakoDjango TemplatesWeb DesignHTMLCascading Style Sheets (CSS)Responsive DesignMinificationCSS FrameworksBootstrapFoundationJavaScriptTask QueuesCeleryRedis Queue (RQ)DramatiqStatic Site GeneratorsPelicanLektorMkDocsTestingUnit TestingIntegration TestingCode MetricsDebuggingWebSocketsuvloopWeb APIsMicroservicesBotsAPI CreationAPI IntegrationTwilioSecurity5. DeploymentServersStatic ContentVirtual Private ServersPlatform-as-a-ServiceOperating SystemsUbuntuWeb ServersApache HTTP ServerNginxCaddyWSGI ServersGreen Unicorn (Gunicorn)Continuous IntegrationJenkinsConfiguration ManagementAnsibleDockerServerlessAWS LambdaGoogle Cloud Functions6. DevOpsMonitoringRollbarCachingLoggingWeb AnalyticsChange LogWhat Full Stack MeansAbout the AuthorFuture DirectionsPage Statuses ...or view all topics.

Matt Makai 2012-2018