Skip to content

Commit 5d52872

Browse files
committed
Add README
1 parent 4e5fef2 commit 5d52872

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# FlyDB-SDK-Python
2+
3+
FlyDB-SDK-Python is a software development toolkit (SDK) for interacting with the FlyDB key-value database in Python.
4+
5+
FlyDB is a high-performance, lightweight key-value database, and with this SDK, you can easily use FlyDB to store and retrieve data in Python.
6+
7+
## Installation
8+
9+
To use FlyDB-SDK-Python, you first need to install the FlyDB server and ensure it is running.
10+
11+
You can install FlyDB-SDK-Python using pip, by running the following command:
12+
13+
```
14+
pip install FlyDB-SDK-Python
15+
```
16+
17+
## Quick Start
18+
19+
Here's a simple example showing how to use FlyDB-SDK-Python to connect to the FlyDB server and perform data storage and retrieval:
20+
21+
```python
22+
from pathlib import Path
23+
from database import db
24+
25+
# Create a database client
26+
db_client = db.FlyDB()
27+
28+
# Connect to the database
29+
path = Path.cwd().joinpath("data")
30+
db_client.connect_option(str(path), 256*1024*1024, True)
31+
32+
# Set a key-value pair
33+
db_client.set("key", "value", 0)
34+
35+
# Get the value of a key
36+
value = db_client.get("key")
37+
print(value)
38+
39+
# Delete a key-value pair
40+
db_client.delete("key")
41+
```
42+
43+
## API ReferenceAPI
44+
45+
FlyDB-SDK-Python currently supports the following APIs:
46+
47+
set(key, value, expire): Stores a key-value pair in the database. The key should be a string, and the value can be a string, integer, float, boolean, or byte stream. The expire parameter represents the expiration time in milliseconds. When expire is set to 0, the data will never expire.
48+
49+
get(key): Retrieves the value of a specified key from the database. The return value type depends on the actual stored data type.
50+
51+
delete(key): Deletes the specified key-value pair from the database.
52+
53+
> For more API reference and detailed usage, please refer to the official documentation or the SDK source code.
54+
>
55+
56+
## Contributions and Feedback
57+
58+
If you encounter any issues or have any suggestions, please feel free to raise them. We welcome contributions from the community. If you want to contribute to the FlyDB-SDK-Python project, please submit a Pull Request or contact our development team.
59+
60+
## License
61+
62+
FlyDB-SDK-Python is licensed under the MIT License. For details, please refer to the LICENSE file.
63+
64+
## Disclaimer
65+
66+
FlyDB-SDK-Python is the official Python SDK for the FlyDB project, maintained and supported by the FlyDB team. Thank you for using FlyDB-SDK-Python, and we hope it brings convenience to your data storage and retrieval tasks!

README_CN.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# FlyDB-SDK-PythonFlyDB-SDK-Python
2+
3+
FlyDB-SDK-Python是用于与FlyDB键值数据库交互的Python软件开发工具包(SDK)。
4+
5+
FlyDB是一个高性能、轻量级的键值数据库,通过这个SDK,您可以方便地在Python中使用FlyDB进行数据的存储和检索。
6+
7+
## 安装
8+
9+
要使用FlyDB-SDK-Python,您首先需要安装FlyDB服务器,并确保其正常运行。
10+
11+
安装FlyDB-SDK-Python可以通过pip进行,运行以下命令:
12+
13+
```bash
14+
pip install FlyDB-SDK-Python
15+
```
16+
17+
## 快速上手
18+
19+
以下是一个简单的示例,展示了如何使用FlyDB-SDK-Python来连接到FlyDB服务器,并进行数据的存储和检索。
20+
21+
```python
22+
from pathlib import Path
23+
from database import db
24+
25+
# Create a database client
26+
db_client = db.FlyDB()
27+
28+
# Connect to the database
29+
path = Path.cwd().joinpath("data")
30+
db_client.connect_option(str(path), 256*1024*1024, True)
31+
32+
# Set a key-value pair
33+
db_client.set("key", "value", 0)
34+
35+
# Get the value of a key
36+
value = db_client.get("key")
37+
print(value)
38+
39+
# Delete a key-value pair
40+
db_client.delete("key")
41+
```
42+
43+
## API参考
44+
45+
FlyDB-SDK-Python目前支持以下几个API:
46+
47+
`set(key, value, expire)`: 存储一个键值对到数据库中,`key`为字符串,`value`可以是字符串、整数、浮点数、布尔值或字节流, `expire`为过期时间,以`ms`为单位,当`expire`为0时,永不过期。
48+
49+
`get(key)`: 从数据库中检索一个键的值,返回值的类型根据实际存储类型而定。
50+
51+
`delete(key)`: 从数据库中删除指定键的数据。
52+
53+
> 更多API参考和详细用法,请参阅官方文档或SDK源代码。
54+
>
55+
56+
## 贡献和问题反馈
57+
58+
如果您发现任何问题或有任何建议,请随时提出。我们欢迎社区的贡献,如果您想为FlyDB-SDK-Python项目做出贡献,请提交Pull Request或者联系我们的开发团队。
59+
60+
## 许可证
61+
62+
FlyDB-SDK-Python项目使用MIT许可证,详情请参阅LICENSE文件。
63+
64+
## 声明
65+
66+
FlyDB-SDK-Python是FlyDB项目的官方Python SDK,由FlyDB团队维护和支持。感谢您使用FlyDB-SDK-Python,希望它能为您的数据存储和检索带来便利!

0 commit comments

Comments
 (0)