kachedb 0.1.0a2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,57 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ concurrency:
10
+ group: ci-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ lint:
15
+ name: Lint
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.12"
24
+
25
+ - name: Install dependencies
26
+ run: pip install -e ".[dev]"
27
+
28
+ - name: Ruff check
29
+ run: ruff check src/ tests/
30
+
31
+ - name: Ruff format check
32
+ run: ruff format --check src/ tests/
33
+
34
+ - name: Mypy type check
35
+ run: mypy src/kachedb/
36
+
37
+ test:
38
+ name: Test (Python ${{ matrix.python-version }})
39
+ runs-on: ubuntu-latest
40
+ strategy:
41
+ fail-fast: false
42
+ matrix:
43
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
44
+
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+
48
+ - name: Set up Python ${{ matrix.python-version }}
49
+ uses: actions/setup-python@v5
50
+ with:
51
+ python-version: ${{ matrix.python-version }}
52
+
53
+ - name: Install package with dev dependencies
54
+ run: pip install -e ".[dev]"
55
+
56
+ - name: Run unit tests
57
+ run: pytest tests/ -v --ignore=tests/test_integration.py -x
@@ -0,0 +1,50 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write # Required for Trusted Publisher (OIDC)
9
+
10
+ jobs:
11
+ build:
12
+ name: Build Distribution
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+
22
+ - name: Install build tools
23
+ run: pip install build
24
+
25
+ - name: Build sdist and wheel
26
+ run: python -m build
27
+
28
+ - name: Upload distribution artifacts
29
+ uses: actions/upload-artifact@v4
30
+ with:
31
+ name: dist
32
+ path: dist/
33
+
34
+ publish:
35
+ name: Publish to PyPI
36
+ needs: build
37
+ runs-on: ubuntu-latest
38
+ environment:
39
+ name: pypi
40
+ url: https://pypi.org/project/kachedb/
41
+
42
+ steps:
43
+ - name: Download distribution artifacts
44
+ uses: actions/download-artifact@v4
45
+ with:
46
+ name: dist
47
+ path: dist/
48
+
49
+ - name: Publish to PyPI
50
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,33 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg-info/
7
+ *.egg
8
+ dist/
9
+ build/
10
+ .eggs/
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # IDE
18
+ .idea/
19
+ .vscode/
20
+ *.swp
21
+ *.swo
22
+
23
+ # Testing
24
+ .pytest_cache/
25
+ .mypy_cache/
26
+ .ruff_cache/
27
+ htmlcov/
28
+ .coverage
29
+ coverage.xml
30
+
31
+ # OS
32
+ .DS_Store
33
+ Thumbs.db
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vubon Roy and KacheDB Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,250 @@
1
+ Metadata-Version: 2.5
2
+ Name: kachedb
3
+ Version: 0.1.0a2
4
+ Summary: High-performance Python client for KacheDB โ€” the zero-copy Redis-compatible & LLM KV-cache storage engine
5
+ Project-URL: Homepage, https://github.com/vubon/kachedb-py
6
+ Project-URL: Repository, https://github.com/vubon/kachedb-py
7
+ Project-URL: Documentation, https://github.com/vubon/kachedb-py#readme
8
+ Project-URL: Bug Tracker, https://github.com/vubon/kachedb-py/issues
9
+ Project-URL: KacheDB Server, https://github.com/vubon/kachedb
10
+ Author: KacheDB Core Team
11
+ License-Expression: Apache-2.0 OR MIT
12
+ License-File: LICENSE-APACHE
13
+ License-File: LICENSE-MIT
14
+ Keywords: cache,kachedb,kv-cache,llm,redis,tensor,vllm,zero-copy
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: License :: OSI Approved :: Apache Software License
19
+ Classifier: License :: OSI Approved :: MIT License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Topic :: Database
27
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
28
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
+ Classifier: Typing :: Typed
30
+ Requires-Python: >=3.10
31
+ Requires-Dist: numpy>=1.24
32
+ Provides-Extra: dev
33
+ Requires-Dist: mypy>=1.0; extra == 'dev'
34
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
35
+ Requires-Dist: pytest>=7.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.4; extra == 'dev'
37
+ Provides-Extra: torch
38
+ Requires-Dist: torch>=2.0; extra == 'torch'
39
+ Description-Content-Type: text/markdown
40
+
41
+ # kachedb
42
+
43
+ <p align="center">
44
+ <strong>High-Performance Python Client for KacheDB โ€” The Zero-Copy Redis-Compatible & LLM KV-Cache Storage Engine</strong>
45
+ </p>
46
+
47
+ <p align="center">
48
+ <a href="https://pypi.org/project/kachedb/"><img src="https://img.shields.io/pypi/v/kachedb.svg" alt="PyPI Version"/></a>
49
+ <a href="https://pypi.org/project/kachedb/"><img src="https://img.shields.io/pypi/pyversions/kachedb.svg" alt="Python Versions"/></a>
50
+ <a href="https://github.com/vubon/kachedb-py/actions"><img src="https://github.com/vubon/kachedb-py/actions/workflows/ci.yml/badge.svg" alt="CI"/></a>
51
+ <a href="https://github.com/vubon/kachedb-py/blob/main/LICENSE-MIT"><img src="https://img.shields.io/badge/license-Apache--2.0%20%2F%20MIT-blue.svg" alt="License"/></a>
52
+ </p>
53
+
54
+ ---
55
+
56
+ ## โšก Installation
57
+
58
+ ```bash
59
+ pip install kachedb
60
+ ```
61
+
62
+ With PyTorch tensor support:
63
+
64
+ ```bash
65
+ pip install kachedb[torch]
66
+ ```
67
+
68
+ ## ๐Ÿš€ Quickstart
69
+
70
+ ### Synchronous Client
71
+
72
+ ```python
73
+ from kachedb import KacheClient
74
+
75
+ with KacheClient(host="127.0.0.1", port=6379) as client:
76
+ # Standard Redis-compatible operations
77
+ client.set("user:1", "alice", ex=3600) # SET with 1-hour TTL
78
+ print(client.get("user:1")) # b"alice"
79
+
80
+ # Batch operations
81
+ client.set("user:2", "bob")
82
+ result = client.mget("user:1", "user:2") # [b"alice", b"bob"]
83
+
84
+ # Check existence
85
+ print(client.exists("user:1")) # 1
86
+
87
+ # Delete
88
+ client.delete("user:1", "user:2")
89
+ ```
90
+
91
+ ### Async Client
92
+
93
+ ```python
94
+ import asyncio
95
+ from kachedb import AsyncKacheClient
96
+
97
+ async def main():
98
+ async with AsyncKacheClient(host="127.0.0.1", port=6379) as client:
99
+ await client.set("key", "value", ex=60)
100
+ result = await client.get("key")
101
+ print(result) # b"value"
102
+
103
+ asyncio.run(main())
104
+ ```
105
+
106
+ ### Pipeline Batching
107
+
108
+ Reduce network round-trips by batching multiple commands:
109
+
110
+ ```python
111
+ from kachedb import KacheClient
112
+
113
+ with KacheClient() as client:
114
+ pipe = client.pipeline()
115
+ pipe.set("a", "1")
116
+ pipe.set("b", "2")
117
+ pipe.set("c", "3")
118
+ pipe.get("a")
119
+ pipe.get("b")
120
+ pipe.get("c")
121
+
122
+ results = pipe.execute()
123
+ # ["OK", "OK", "OK", b"1", b"2", b"3"]
124
+ ```
125
+
126
+ ### Async Pipeline
127
+
128
+ ```python
129
+ from kachedb import AsyncKacheClient
130
+
131
+ async def main():
132
+ async with AsyncKacheClient() as client:
133
+ pipe = client.pipeline()
134
+ pipe.set("x", "10")
135
+ pipe.get("x")
136
+ results = await pipe.execute()
137
+ # ["OK", b"10"]
138
+ ```
139
+
140
+ ### Zero-Copy Tensor Access (LLM KV-Cache)
141
+
142
+ Read KV-cache tensors directly from KacheDB's shared memory with **zero data copying**:
143
+
144
+ ```python
145
+ from kachedb import read_tensor, read_torch_tensor
146
+
147
+ # Read as numpy array (zero-copy via /dev/shm)
148
+ np_tensor = read_tensor(core_id=0, byte_offset=0)
149
+ print(np_tensor.shape, np_tensor.dtype)
150
+
151
+ # Read as PyTorch tensor (requires: pip install kachedb[torch])
152
+ torch_tensor = read_torch_tensor(core_id=0, byte_offset=0)
153
+ print(torch_tensor.shape, torch_tensor.dtype)
154
+ ```
155
+
156
+ ## ๐Ÿ“‹ Supported Commands
157
+
158
+ All commands follow the [KacheDB RESP2/RESP3 wire protocol](https://github.com/vubon/kachedb):
159
+
160
+ | Command | Method | Description |
161
+ | :--- | :--- | :--- |
162
+ | `PING` | `client.ping()` | Test server liveness |
163
+ | `SET` | `client.set(key, value, ex=, px=)` | Store value with optional TTL |
164
+ | `GET` | `client.get(key)` | Retrieve value |
165
+ | `MGET` | `client.mget(*keys)` | Batch retrieve multiple keys |
166
+ | `DEL` | `client.delete(*keys)` | Delete keys |
167
+ | `EXISTS` | `client.exists(*keys)` | Count existing keys |
168
+
169
+ ## ๐Ÿ—๏ธ Architecture
170
+
171
+ ```text
172
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
173
+ โ”‚ Your Python App โ”‚
174
+ โ”‚ (vLLM / SGLang / FastAPI / etc.) โ”‚
175
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
176
+ โ”‚ kachedb Python SDK โ”‚
177
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
178
+ โ”‚ โ”‚ KacheClient โ”‚ โ”‚ AsyncKache โ”‚ โ”‚ Pipeline โ”‚ โ”‚
179
+ โ”‚ โ”‚ (sync TCP) โ”‚ โ”‚ Client โ”‚ โ”‚ Batching โ”‚ โ”‚
180
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
181
+ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
182
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
183
+ โ”‚ โ”‚ RESP2/RESP3 Protocol Engine โ”‚ โ”‚
184
+ โ”‚ โ”‚ (64KB buffered encoder + decoder) โ”‚ โ”‚
185
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
186
+ โ”‚ โ”‚ โ”‚
187
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
188
+ โ”‚ โ”‚ ConnectionPool / AsyncConnectionPool โ”‚ โ”‚
189
+ โ”‚ โ”‚ (Thread-safe / asyncio.Queue, health checks) โ”‚ โ”‚
190
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
191
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
192
+ โ”‚ TCP + /dev/shm โ”‚
193
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
194
+ โ”‚ KacheDB Server (Rust) โ”‚
195
+ โ”‚ io_uring / kqueue โ”‚ POSIX SHM โ”‚ Megaslab โ”‚
196
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
197
+ ```
198
+
199
+ ## ๐Ÿ”ง Connection Pool
200
+
201
+ The client automatically manages a connection pool:
202
+
203
+ ```python
204
+ from kachedb import KacheClient
205
+
206
+ # Pool with up to 20 connections
207
+ client = KacheClient(
208
+ host="127.0.0.1",
209
+ port=6379,
210
+ max_connections=20,
211
+ socket_timeout=5.0,
212
+ )
213
+ ```
214
+
215
+ ## ๐Ÿงช Development
216
+
217
+ ```bash
218
+ # Clone
219
+ git clone https://github.com/vubon/kachedb-py.git
220
+ cd kachedb-py
221
+
222
+ # Install in dev mode
223
+ pip install -e ".[dev]"
224
+
225
+ # Run unit tests
226
+ pytest tests/ -v --ignore=tests/test_integration.py
227
+
228
+ # Run integration tests (requires running KacheDB server)
229
+ pytest tests/test_integration.py -v
230
+
231
+ # Lint
232
+ ruff check src/ tests/
233
+ ruff format --check src/ tests/
234
+
235
+ # Type check
236
+ mypy src/kachedb/
237
+ ```
238
+
239
+ ## ๐Ÿ”— Related Projects
240
+
241
+ - **[KacheDB Server](https://github.com/vubon/kachedb)** โ€” The Rust storage engine
242
+
243
+ ## ๐Ÿ“„ License
244
+
245
+ Dual-licensed under either of:
246
+
247
+ - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
248
+ - MIT license ([LICENSE-MIT](LICENSE-MIT))
249
+
250
+ at your option.