Skip to main content

Redislite

CI/CD Build Status Codestyle Coverage Current Version Supported Python License Documentation

Description

Redislite is a self contained Python interface to the Redis key-value store.

It provides enhanced versions of the Redis-Py Python bindings for Redis. That provide the following added functionality:

  • Easy to use - It provides a built in Redis server that is automatically installed, configured and managed when the Redis bindings are used.
  • Flexible - Create a single server shared by multiple programs or multiple independent servers. All the servers provided by Redislite support all Redis functionality including advanced features such as replication and clustering.
  • Compatible - It provides enhanced versions of the Redis-Py python Redis bindings as well as functions to patch them to allow most existing code that uses them to run with little or no modifications.
  • Secure - It uses a secure default Redis configuraton that is only accessible by the creating user on the computer system it is run on.

Requirements

The redislite module requires Python 3.6 or higher.

Installing requirements on Linux

Make sure Python development headers are available when installing redislite.

On Ubuntu/Debian systems, install them with:

apt-get install python-dev

On Redhat/Fedora systems, install them with:

yum install python-devel

Installing requirements on Mac OSX

Redislite for OSX comes as a wheel package by default that can be installed using current versions of pip.

To install Redislite on MacOSX using the sdist package instead you will need the XCode command line utilities installed. If you do not have xcode installed on recent OSX releases they can be installed by running:

xcode-select --install

Installing requirements on Microsoft Windows

Redislite can be installed on newer releases of Windows 10 under the Bash on Ubuntu shell.

Install it using the instructions at https://msdn.microsoft.com/commandline/wsl/install_guide

Then start the bash shell and install the python-dev package as follows:

apt-get install python-dev

Installation

To install redislite, simply:

$ pip install redislite

or from source:

$ python setup.py install

Getting Started

redislite provides enhanced versions of the redis-py redis.Redis() and redis.StrictRedis() classes that take the same arguments as the corresponding redis classes and take one additional optional argument. Which is the name of the Redis rdb file to use. If the argument is not provided it will create set up a new redis server.

redislite also provides functions to MonkeyPatch the redis.Redis and redis.StrictRedis classes to use redislite, so existing python code that uses Redis can use the redislite version.

Examples

Here are some examples of using the redislite module.

Setting a value

Here we open a Python shell and set a key in our embedded Redis db. Redislite will automatically start the Redis server when the Redis() object is created and shut it down cleanly when the Python interpreter exits.

>>> from redislite import Redis
>>> redis_connection = Redis('/tmp/redis.db')
>>> redis_connection.keys()
[]
>>> redis_connection.set('key', 'value')
True
>>> redis_connection.get('key')
'value'

Persistence

Now we open the same Redis db and access the key we created during the last run. Redislite will automatically start the Redis server using the same configuration as last time, so the value that was set in the previous example is still available.

>>> from redislite import Redis
>>> redis_connection = Redis('/tmp/redis.db')
>>> redis_connection.keys()
['key']
>>> redis_connection.get('key')
'value'

Compatibility

It's possible to MonkeyPatch the normal Redis classes to allow modules that use Redis to use the redislite classes. Here we patch Redis and use the redis_collections module.

>>> import redislite.patch
>>> redislite.patch.patch_redis()
>>> import redis_collections
>>> td = redis_collections.Dict()
>>> td['foo']='bar'
>>> td.keys()
['foo']

Running and using Multiple servers

Redislite will start a new server if the redis rdb fileame isn't specified or is new. In this example we start 10 seperate redis servers and set the value of the key 'servernumber' to a different value in each server.

Then we access the value of 'servernumber' and print it.

>>> import redislite
>>> servers = {}
>>> for redis_server_number in range(10):
...     servers[redis_server_number] = redislite.Redis()
...     servers[redis_server_number].set('servernumber', redis_server_number)
...
True
True
True
True
True
True
True
True
True
True
>>> for redis_server in servers.values():
...     redis_server.get('servernumber')
...
b'0'
b'1'
b'2'
b'3'
b'4'
b'5'
b'6'
b'7'
b'8'
b'9'

Multiple Servers with different configurations in the same script

It's possible to spin up multiple instances with different configuration settings for the Redis server. Here is an example that sets up 2 redis server instances. One instance is configured to listen on port 8002, the second instance is a read-only slave of the first instance.

>>> import redislite
>>> master=redislite.Redis(serverconfig={'port': '8002'})
>>> slave=redislite.Redis(serverconfig={'slaveof': "127.0.0.1 8002"})
>>> slave.keys()
[]
>>> master.set('key', 'value')
True
>>> master.keys()
['key']
>>> slave.keys()
['key']
>>>

More Information

There is more detailed information on the redislite documentation page at http://redislite.readthedocs.org/en/latest/

Redislite is Free software under the New BSD license, see LICENSE.txt for details.

Release files for redislite 6.2.805324

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redislite 6.2.805324
File Size Uploaded
redislite-6.2.805324.tar.gz 2.5 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for redislite 6.2.805324
File
redislite-6.2.805324-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.9 PyPy 3.9 7.3 Linux glibc 2.17+ x86-64 Details
redislite-6.2.805324-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.8 PyPy 3.8 7.3 Linux glibc 2.17+ x86-64 Details
redislite-6.2.805324-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl PyPy 3.8 PyPy 3.8 7.3 Linux glibc 2.12+ x86-64 Details
redislite-6.2.805324-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.7 PyPy 3.7 7.3 Linux glibc 2.17+ x86-64 Details
redislite-6.2.805324-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl PyPy 3.7 PyPy 3.7 7.3 Linux glibc 2.12+ x86-64 Details
redislite-6.2.805324-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
redislite-6.2.805324-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.12+ x86-64 Details
redislite-6.2.805324-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
redislite-6.2.805324-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.12+ x86-64 Details
redislite-6.2.805324-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
redislite-6.2.805324-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.12+ x86-64 Details
redislite-6.2.805324-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
redislite-6.2.805324-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details
redislite-6.2.805324-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
redislite-6.2.805324-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details

Total release size: 92.4 MB

Release files / redislite-6.2.805324.tar.gz

Download URL redislite-6.2.805324.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
603b28bcdfdbe45edfe0046dc99b0fcbe3d5c533d1b7e5d9c3ff6208a656e7f1
BLAKE2b-256 checksum
How to use checksums
9dd067411c3d854e67f67be981d83f8e065e387e6f764d76dd6e9dfd1c5d2089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL redislite-6.2.805324-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.1 MB
Tags Linux glibc 2.17+ x86-64 PyPy 3.9 PyPy 3.9 7.3
SHA-256 checksum
How to use checksums
7723317952715b7fa5e21d14ef3cf4d5a18f43f828e04b39712fa8d13d2274ff
BLAKE2b-256 checksum
How to use checksums
503e1f3c5afad39577479c27b816b9f9390a2be57e744a7644fca02ac7870763
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL redislite-6.2.805324-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.1 MB
Tags Linux glibc 2.17+ x86-64 PyPy 3.8 PyPy 3.8 7.3
SHA-256 checksum
How to use checksums
4e86ef58c491a6dc0c04fad86c286bb43edc128b26006ef90b2b49ed1d38e089
BLAKE2b-256 checksum
How to use checksums
e5c7919966963519da98870c57b6b6d56f4b37b07d0f714449ffef506c267dc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL redislite-6.2.805324-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 5.9 MB
Tags Linux glibc 2.12+ x86-64 PyPy 3.8 PyPy 3.8 7.3
SHA-256 checksum
How to use checksums
4640ed4533c176b3b1fab4592af39d3fab6423843c7634b6b5aba980dfc5d578
BLAKE2b-256 checksum
How to use checksums
2c0f847a285c76af91277dc194e0b3049791491cc88fd06b712525d65aa6fe92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL redislite-6.2.805324-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.1 MB
Tags Linux glibc 2.17+ x86-64 PyPy 3.7 PyPy 3.7 7.3
SHA-256 checksum
How to use checksums
731b6d239f67f8fc9e3d801dca26269291b94be772c37bc2b65a884c9d79138e
BLAKE2b-256 checksum
How to use checksums
41334c5eb247d09ffdbecc46ee61d2f452dd0f28c04f004ffa1341f832cc1d06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL redislite-6.2.805324-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 5.9 MB
Tags Linux glibc 2.12+ x86-64 PyPy 3.7 PyPy 3.7 7.3
SHA-256 checksum
How to use checksums
79f4540aa4c5f6cd85370a504b6610ef6995775307389559ad4001f61949c229
BLAKE2b-256 checksum
How to use checksums
506f00a6062034e50872e1967db0c2dc9f44500805a324192dffa8975c601d39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL redislite-6.2.805324-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.1 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a704fdfb74b4b1711f86b98deeb0627ed7bbdf21653e48146d9369cda2fc40c4
BLAKE2b-256 checksum
How to use checksums
bf3894bd935e3e4c01959dc3e17ba30d5e9757ed462f13387e155c4859f3abe4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL redislite-6.2.805324-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 5.9 MB
Tags CPython 3.11 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
0b3f202cee43bda332f97615ecf4a7c3b2b91c9ab28abf0494a21f6829d19101
BLAKE2b-256 checksum
How to use checksums
107026c522f45e4ffc1554e41c42161bc67a7c55610aa0a8b1bc8f097e369f16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL redislite-6.2.805324-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c6abef5810940eca315b8c90f45b0ebda8e76c0a0ea6e9f606b8166f01a082b1
BLAKE2b-256 checksum
How to use checksums
334ed2196e03940f811aa94186b4fca44e5e327a96881bc47323e7a1d96664ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL redislite-6.2.805324-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 5.9 MB
Tags CPython 3.10 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
0f0642a5a6b79d086260e2ce42a95744dc5e5339f571ac149705730de8f68be9
BLAKE2b-256 checksum
How to use checksums
359dcefe5c2c1347320e79223a00257f61185b6dc482fa16dd5cf8e87c3a26a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL redislite-6.2.805324-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9fbb1433b4a2d88889b550bd08c6885a58446d204c6ee031a5a2fdee83620f46
BLAKE2b-256 checksum
How to use checksums
1ab08e2ae6dcbdfcb7e8236320028f2d874891574fff8ce19386a82fb0dda95e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL redislite-6.2.805324-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 5.9 MB
Tags CPython 3.9 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
bdd673e51b42d515b273518c4670d2d94d54542baa67b2d4c8951e47e05cd349
BLAKE2b-256 checksum
How to use checksums
72aa3b1a1101e53b9176612089d58351f6d60ac7bb7c3e890593282f50c7e62b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL redislite-6.2.805324-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.1 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
4904fe27211637c17dd98b4547cc6de4cacf231b394b5174d7acca38409db5c4
BLAKE2b-256 checksum
How to use checksums
d3245c629a4f4d78e7b47a373bc83b0699a63eb558ae682635cce467bc0d5c58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL redislite-6.2.805324-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 5.9 MB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
ba35f7600d119a1db1cbae77c0591b8e0feb351689117c68c23bc5f34d3442af
BLAKE2b-256 checksum
How to use checksums
371e0ee263c8b6277baa180ed5e044b4eab3f8df50a331d3dde8298556b5bfa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL redislite-6.2.805324-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.1 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8ad793d9b45d2e77d36753b695391c1a9e77a84b1782f7ea5d42fb5af3bbe86a
BLAKE2b-256 checksum
How to use checksums
b95f912727e9af9e4ebb3eca4c08223400261a42db420e628bd29bbacfd15f91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / redislite-6.2.805324-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL redislite-6.2.805324-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 5.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
09989c29788e2a4ab0c946869582451f6a46b4099a17482560d990250ffad696
BLAKE2b-256 checksum
How to use checksums
43c896c0d4179d60f7e116aff5c9d54501ebe6b2c14339137216cd2fdc58983f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release history Release notifications | RSS feed

This release

6.2.805324 This release

16 release files

3.2.310

1 release file

3.0.282

1 release file

3.0.273

1.0.210

1 release file

1.0.151

1 release file

1.0.93

1 release file

1.0.63

1 release file

1.0.60

1 release file

1.0.59

1 release file

1.0.38

1 release file

1.0.13

1 release file

1.0.12

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page