{"id":13502134,"url":"https://github.com/yahoo/redislite","last_synced_at":"2025-05-15T09:08:36.856Z","repository":{"id":28075369,"uuid":"31572652","full_name":"yahoo/redislite","owner":"yahoo","description":"Redis in a python module.","archived":false,"fork":false,"pushed_at":"2024-08-16T10:24:19.000Z","size":7253,"stargazers_count":589,"open_issues_count":35,"forks_count":76,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-04-11T19:55:39.166Z","etag":null,"topics":["big-data","database","key-value","python","redis","redis-bindings","redis-server","redislite","screwdriver"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yahoo.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.d/137.feature.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"Code-of-Conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-03T01:15:53.000Z","updated_at":"2025-04-02T17:49:42.000Z","dependencies_parsed_at":"2024-11-13T10:40:25.797Z","dependency_job_id":null,"html_url":"https://github.com/yahoo/redislite","commit_stats":{"total_commits":242,"total_committers":19,"mean_commits":"12.736842105263158","dds":0.4421487603305785,"last_synced_commit":"beafd4a0c0574de8fe89efaa28a1174d7c564b76"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fredislite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fredislite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fredislite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fredislite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yahoo","download_url":"https://codeload.github.com/yahoo/redislite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310520,"owners_count":22049470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["big-data","database","key-value","python","redis","redis-bindings","redis-server","redislite","screwdriver"],"created_at":"2024-07-31T22:02:03.198Z","updated_at":"2025-05-15T09:08:31.839Z","avatar_url":"https://github.com/yahoo.png","language":"Python","readme":"# Redislite\n\n[![CI/CD](https://img.shields.io/badge/CI/CD-Screwdriver-blue.svg)](https://screwdriver.cd/)\n[![Build Status](https://cd.screwdriver.cd/pipelines/2880/badge)](https://cd.screwdriver.cd/pipelines/2880)\n[![Codestyle](https://img.shields.io/badge/code%20style-pep8-blue.svg)](https://www.python.org/dev/peps/pep-0008/)\n[![Coverage](https://codecov.io/gh/yahoo/redislite/branch/master/graph/badge.svg)](https://codecov.io/gh/yahoo/redislite)\n[![Current Version](https://img.shields.io/pypi/v/redislite.svg)](https://pypi.python.org/pypi/redislite/)\n[![Supported Python](https://img.shields.io/badge/python-3.6,3.7,3.8-blue.svg)](https://pypi.python.org/pypi/redislite/)\n[![License](https://img.shields.io/pypi/l/redislite.svg)](https://pypi.python.org/pypi/redislite/)\n[![Documentation](https://readthedocs.org/projects/redislite/badge/?version=latest)](http://redislite.readthedocs.org/en/latest/)\n\n\n## Description\n\nRedislite is a self contained Python interface to the Redis key-value store.\n\nIt provides enhanced versions of the Redis-Py Python bindings for Redis.  That provide the following added functionality:\n\n* **Easy to use** - It provides a built in Redis server that is automatically installed, configured and managed when the Redis bindings are used.\n* **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.\n* **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.\n* **Secure** - It uses a secure default Redis configuraton that is only accessible by the creating user on the computer system it is run on.\n\n## Requirements\n\nThe redislite module requires Python 3.6 or higher.\n\n\n### Installing requirements on Linux\n\nMake sure Python development headers are available when installing redislite.\n\nOn Ubuntu/Debian systems, install them with:\n\n`apt-get install python-dev`\n\nOn Redhat/Fedora systems, install them with:\n\n`yum install python-devel`\n\n### Installing requirements on Mac OSX\n\nRedislite for OSX comes as a wheel package by default that can be installed\nusing current versions of pip.\n\nTo install Redislite on MacOSX using the sdist package instead you will need\nthe XCode command line utilities installed.  If you do not have xcode\ninstalled on recent OSX releases they can be installed by\nrunning:\n\n`xcode-select --install`\n\n### Installing requirements on Microsoft Windows\n\nRedislite can be installed on newer releases of Windows 10 under the Bash on Ubuntu shell.\n\nInstall it using the instructions at https://msdn.microsoft.com/commandline/wsl/install_guide \n\nThen start the bash shell and install the python-dev package as follows:\n\n`apt-get install python-dev`    \n    \n## Installation\n\nTo install redislite, simply:\n\n```console\n$ pip install redislite\n```\n\nor from source:\n\n```console\n$ python setup.py install\n```\n\n\n## Getting Started\n\nredislite provides enhanced versions of the redis-py redis.Redis() and \nredis.StrictRedis() classes that take the same arguments as the corresponding\nredis classes and take one additional optional argument.  Which is the\nname of the Redis rdb file to use.  If the argument is not provided it will\ncreate set up a new redis server.\n\nredislite also provides functions to MonkeyPatch the redis.Redis and \nredis.StrictRedis classes to use redislite, so existing python code that uses\nRedis can use the redislite version.\n    \n## Examples\n\nHere are some examples of using the redislite module.\n\n### Setting a value\n\nHere we open a Python shell and set a key in our embedded Redis db.  Redislite will automatically start the Redis server when\nthe Redis() object is created and shut it down cleanly when the Python interpreter exits.\n\n```python\n\u003e\u003e\u003e from redislite import Redis\n\u003e\u003e\u003e redis_connection = Redis('/tmp/redis.db')\n\u003e\u003e\u003e redis_connection.keys()\n[]\n\u003e\u003e\u003e redis_connection.set('key', 'value')\nTrue\n\u003e\u003e\u003e redis_connection.get('key')\n'value'\n```\n\n### Persistence\n\nNow we open the same Redis db and access the key we created during the last run.  Redislite will automatically start the\nRedis server using the same configuration as last time, so the value that was set in the previous example is still available.\n\n```python\n\u003e\u003e\u003e from redislite import Redis\n\u003e\u003e\u003e redis_connection = Redis('/tmp/redis.db')\n\u003e\u003e\u003e redis_connection.keys()\n['key']\n\u003e\u003e\u003e redis_connection.get('key')\n'value'\n```\n\n## Compatibility\n\nIt's possible to MonkeyPatch the normal Redis classes to allow modules \nthat use Redis to use the redislite classes.  Here we patch Redis and use the \nredis_collections module.\n\n```python\n\u003e\u003e\u003e import redislite.patch\n\u003e\u003e\u003e redislite.patch.patch_redis()\n\u003e\u003e\u003e import redis_collections\n\u003e\u003e\u003e td = redis_collections.Dict()\n\u003e\u003e\u003e td['foo']='bar'\n\u003e\u003e\u003e td.keys()\n['foo']\n```\n\n## Running and using Multiple servers\n\nRedislite 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.  \n\nThen we access the value of 'servernumber' and print it.\n\n```python\n\u003e\u003e\u003e import redislite\n\u003e\u003e\u003e servers = {}\n\u003e\u003e\u003e for redis_server_number in range(10):\n...     servers[redis_server_number] = redislite.Redis()\n...     servers[redis_server_number].set('servernumber', redis_server_number)\n...\nTrue\nTrue\nTrue\nTrue\nTrue\nTrue\nTrue\nTrue\nTrue\nTrue\n\u003e\u003e\u003e for redis_server in servers.values():\n...     redis_server.get('servernumber')\n...\nb'0'\nb'1'\nb'2'\nb'3'\nb'4'\nb'5'\nb'6'\nb'7'\nb'8'\nb'9'\n```\n\n## Multiple Servers with different configurations in the same script\n\nIt's possible to spin up multiple instances with different\nconfiguration settings for the Redis server.  Here is an example that sets up 2\nredis server instances.  One instance is configured to listen on port 8002, the\nsecond instance is a read-only slave of the first instance.\n\n\n```python\n\u003e\u003e\u003e import redislite\n\u003e\u003e\u003e master=redislite.Redis(serverconfig={'port': '8002'})\n\u003e\u003e\u003e slave=redislite.Redis(serverconfig={'slaveof': \"127.0.0.1 8002\"})\n\u003e\u003e\u003e slave.keys()\n[]\n\u003e\u003e\u003e master.set('key', 'value')\nTrue\n\u003e\u003e\u003e master.keys()\n['key']\n\u003e\u003e\u003e slave.keys()\n['key']\n\u003e\u003e\u003e\n```\n\n## More Information\n\nThere is more detailed information on the redislite documentation page at\nhttp://redislite.readthedocs.org/en/latest/\n\nRedislite is Free software under the New BSD license, see LICENSE.txt for\ndetails.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Fredislite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyahoo%2Fredislite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Fredislite/lists"}