# Litedis
Litedis 是一个轻量级的 模仿Redis 的本地实现,它实现了和 Redis 类似的功能,支持基本的数据结构和操作。适合调试代码时,没有 Redis 服务器或者不想连接 Redis 服务器的情况下使用。
## 功能特点
- 实现了基础数据结构:
- STING
- LIST
- HASH
- SET
- ZSET
- 支持过期时间设置
- 支持持久化,包括 AOF 和 LDB、以及混合模式
- 简单轻量,数据存储在本地,无需服务器
## 使用示例
基本使用
```py
import time
from litedis import Litedis
with Litedis("litedis:///data/db") as db:
db.set("key", "value", ex=1)
assert db.get("key") == "value"
time.sleep(1.1)
assert not db.get("key")
```
Raw data
{
"_id": null,
"home_page": "https://github.com/linsuiyuan/litedis",
"name": "litedis",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Linsuiyuan",
"author_email": "linsuiyuan@icloud.com",
"download_url": "https://files.pythonhosted.org/packages/27/8d/f12a9b96cc44e7cdd168f3807accfdb8891b5583b1e1da422ee3eecbbf61/litedis-2.2.3.tar.gz",
"platform": null,
"description": "# Litedis\n\nLitedis \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 \u6a21\u4effRedis \u7684\u672c\u5730\u5b9e\u73b0\uff0c\u5b83\u5b9e\u73b0\u4e86\u548c Redis \u7c7b\u4f3c\u7684\u529f\u80fd\uff0c\u652f\u6301\u57fa\u672c\u7684\u6570\u636e\u7ed3\u6784\u548c\u64cd\u4f5c\u3002\u9002\u5408\u8c03\u8bd5\u4ee3\u7801\u65f6\uff0c\u6ca1\u6709 Redis \u670d\u52a1\u5668\u6216\u8005\u4e0d\u60f3\u8fde\u63a5 Redis \u670d\u52a1\u5668\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\u3002\n\n## \u529f\u80fd\u7279\u70b9\n\n- \u5b9e\u73b0\u4e86\u57fa\u7840\u6570\u636e\u7ed3\u6784\uff1a\n - STING\n - LIST\n - HASH\n - SET\n - ZSET\n- \u652f\u6301\u8fc7\u671f\u65f6\u95f4\u8bbe\u7f6e\n- \u652f\u6301\u6301\u4e45\u5316\uff0c\u5305\u62ec AOF \u548c LDB\u3001\u4ee5\u53ca\u6df7\u5408\u6a21\u5f0f\n- \u7b80\u5355\u8f7b\u91cf\uff0c\u6570\u636e\u5b58\u50a8\u5728\u672c\u5730\uff0c\u65e0\u9700\u670d\u52a1\u5668\n\n## \u4f7f\u7528\u793a\u4f8b\n\n\u57fa\u672c\u4f7f\u7528\n\n```py\nimport time\n\nfrom litedis import Litedis\n\nwith Litedis(\"litedis:///data/db\") as db:\n db.set(\"key\", \"value\", ex=1)\n assert db.get(\"key\") == \"value\"\n\n time.sleep(1.1)\n assert not db.get(\"key\")\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Litedis \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 \u6a21\u4effRedis \u7684\u672c\u5730\u5b9e\u73b0\uff0c\u5b83\u5b9e\u73b0\u4e86\u548c Redis \u7c7b\u4f3c\u7684\u529f\u80fd",
"version": "2.2.3",
"project_urls": {
"Homepage": "https://github.com/linsuiyuan/litedis"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58d43fe95423d87f98f83b5fcd8e22263605147cbb5074ec16a6512952581182",
"md5": "9b6d15fe6655c27cc3a84fc6a13d9051",
"sha256": "0b68d234b07ffd37c8193e785ff2d33e58082915cc97b2f1ec9ca7f057b77658"
},
"downloads": -1,
"filename": "litedis-2.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9b6d15fe6655c27cc3a84fc6a13d9051",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21228,
"upload_time": "2024-11-30T03:13:16",
"upload_time_iso_8601": "2024-11-30T03:13:16.579617Z",
"url": "https://files.pythonhosted.org/packages/58/d4/3fe95423d87f98f83b5fcd8e22263605147cbb5074ec16a6512952581182/litedis-2.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "278df12a9b96cc44e7cdd168f3807accfdb8891b5583b1e1da422ee3eecbbf61",
"md5": "b02f801e019f30c02ab20dc190613965",
"sha256": "cf4189152559c3a1f4630d511cc8876eefb88f9388e324a8099df5c7a1f6b4b6"
},
"downloads": -1,
"filename": "litedis-2.2.3.tar.gz",
"has_sig": false,
"md5_digest": "b02f801e019f30c02ab20dc190613965",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 19420,
"upload_time": "2024-11-30T03:13:28",
"upload_time_iso_8601": "2024-11-30T03:13:28.052725Z",
"url": "https://files.pythonhosted.org/packages/27/8d/f12a9b96cc44e7cdd168f3807accfdb8891b5583b1e1da422ee3eecbbf61/litedis-2.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-30 03:13:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "linsuiyuan",
"github_project": "litedis",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "litedis"
}