OpenKache Python client
OpenKache is a high-performance cache server designed from the ground up for modern SSDs. Use this Python client to store, read, and delete values in a few lines.
Install
Python 3.11 or newer is required.
# pip
python -m pip install openkache
# uv
uv add openkache
# Existing uv virtual environment:
uv pip install openkache
# Poetry
poetry add openkache
# PDM
pdm add openkache
# Pipenv
pipenv install openkache
Published wheels support Linux x86_64/ARM64, macOS x86_64/ARM64, and Windows
x86_64/ARM64. Linux wheels use the manylinux_2_38 policy tag; macOS and
Windows tags come from their native Python packaging toolchain. Other
Rust-supported targets can install from the source distribution.
The native Rust adapter supports Linux, macOS, and Windows on Rust-supported
host architectures, including ARM64. Building from source requires Python,
Rust 1.85 or newer, and the platform's normal C linker. The package selects
.so, .dylib, or .dll at import time and does not assume Linux.
On Windows checkouts, run the generator from PowerShell:
$env:OPENKACHE_GENERATION_TARGET = "python"
..\generate.ts
Quick start
The example below assumes a local OpenKache server at 127.0.0.1:4433.
from openkache import Client
client = Client.connect("127.0.0.1:4433")
print(client.set("greeting", "hello")) # -> created
print(client.get("greeting")) # -> hello
print(client.delete("greeting")) # -> True
client.close()
set returns SetOutcome.CREATED for a new key,
get returns the value directly (None when the key is absent), and delete
returns True when a value was removed.
The example uses the local development TLS profile, which does not verify the server certificate. Use it only with a local development server.
Reference
Client.connect(address)
Opens a connection and returns a Client.
- Input: a non-empty
host:portstring. IPv6 endpoints use[host]:port. - Returns:
Client. - Raises:
OpenKacheErrorwhen the connection cannot be opened.
client = Client.connect("127.0.0.1:4433")
Client and OpenKacheClient refer to the same class.
client.get(key)
Reads one value as a native Python value by default.
- Input: a UTF-8
str, signed 64-bitint, or bytes-like value (bytes,bytearray, ormemoryview). - Returns: the decoded value, or
Nonewhen the key is absent. StoredNoneand undefined values also returnNone, matching ordinary Python cache APIs. - Raises:
OpenKacheValueErrorfor an invalid key, an ambiguous native map, or a value that cannot be projected to Python;OpenKacheErrorfor connection or server failures.
print(client.get("greeting")) # -> "hello"
Use representation="lossless" when the exact value model matters:
exact = client.get("greeting", representation="lossless")
print(exact) # -> TextStringValue(value='hello')
Native reads map integers to int, floats to float, bytes to bytes,
arrays to list, and maps to dict when their keys remain distinct under
Python equality. A stored None or undefined value returns None, just like
an absent key. Use the lossless representation for the distinction between
Null and Undefined, float width/raw bits, or model-distinct map keys such
as True and 1.
client.set(key, value)
Stores one value, replacing any existing value for the key.
- Input: the same key types accepted by
get, plus a native or lossless structured value. - Returns:
SetOutcome.CREATEDfor a new key orSetOutcome.REPLACEDfor an existing key. - Raises:
OpenKacheValueErrorfor an invalid key or value andOpenKacheErrorfor connection or server failures.
outcome = client.set("greeting", "hello")
# outcome is SetOutcome.CREATED or SetOutcome.REPLACED
client.delete(key)
Deletes one key. Deleting a missing key is safe.
- Input: a key accepted by
get. - Returns:
Truewhen a value was removed, orFalsewhen no value existed. - Raises:
OpenKacheValueErrorfor an invalid key andOpenKacheErrorfor connection or server failures.
removed = client.delete("greeting")
if removed:
print("deleted")
client.close()
Closes the connection and returns None. Calling it more than once is safe.
client.close()
The client also supports with Client.connect(address), which closes the
connection automatically when the block exits.
Keys
Keys are typed. Use:
strfor UTF-8 text keys;intfor signed 64-bit integer keys;bytes,bytearray, ormemoryviewfor exact byte keys.
client.get("text-key")
client.get(42)
client.get(b"bytes-key")
Values
The client converts common Python values to structured values:
Nonebecomes Null.boolbecomes Boolean.intbecomes an exact Integer.floatbecomes an IEEE-754 binary64 Float.strbecomes UTF-8 TextString.bytes,bytearray, andmemoryviewbecome Bytes.listandtuplebecome Array.dictbecomes Map.
client.set("profile", {"name": "Ada", "active": True})
Use the lossless model when the exact representation matters:
UNDEFINED/UndefinedValue, IntegerValue, FloatValue,
ByteStringValue, TextStringValue, ArrayValue, and MapValue.
The short names Undefined, Integer, Float, ByteString, TextString,
Array, Map, and Value are compatibility aliases.
Value helpers
to_value(value, limits=None)converts a native Python value to the lossless model.encode_value(value, limits=None)returns one encodedStructuredValue-CBOR-v1item asbytes.decode_value(data, limits=None)decodes one complete item frombytes-like input.model_equal(left, right)compares model values without treatingTrueand1as equal.to_native(value)projects a decoded lossless value to the native representation used byclient.get(..., representation="native").ValueLimitsbounds encoded bytes, nesting depth, item count, and integer magnitude.
from openkache import decode_value, encode_value, model_equal, to_value
encoded = encode_value({"count": 1})
decoded = decode_value(encoded)
assert model_equal(decoded, to_value({"count": 1}))
StructuredValueError reports conversion, encoding, decoding, and resource
limit failures. Its kind property is a ValueErrorKind.
Errors
OpenKacheError— connection, protocol, server, or operation failure.OpenKacheValueError— invalid key or value supplied by the caller.OpenKacheUnknownMutationError— a mutation may have reached the server without a confirmed result; do not replay it automatically.OpenKacheIncompatibleServerError— the server returned an outcome that this client does not support.StructuredValueError— invalid structured-value data or resource limits.
Strings must contain well-formed Unicode. Unpaired UTF-16 surrogate code units are rejected.
More information
Metadata
Release files for openkache 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openkache-0.1.3.tar.gz | 518.9 kB | With provenance | Details for openkache-0.1.3.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| openkache-0.1.3-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details for openkache-0.1.3-py3-none-win_arm64.whl |
| openkache-0.1.3-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for openkache-0.1.3-py3-none-win_amd64.whl |
| openkache-0.1.3-py3-none-manylinux_2_38_x86_64.whl | Python 3 | none | Linux glibc 2.38+ x86-64 | Details for openkache-0.1.3-py3-none-manylinux_2_38_x86_64.whl |
| openkache-0.1.3-py3-none-manylinux_2_38_aarch64.whl | Python 3 | none | Linux glibc 2.38+ ARM64 | Details for openkache-0.1.3-py3-none-manylinux_2_38_aarch64.whl |
| openkache-0.1.3-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for openkache-0.1.3-py3-none-macosx_11_0_arm64.whl |
| openkache-0.1.3-py3-none-macosx_10_13_x86_64.whl | Python 3 | none | macOS 10.13+ x86-64 | Details for openkache-0.1.3-py3-none-macosx_10_13_x86_64.whl |
Total release size: 23.1 MB
Release files / openkache-0.1.3.tar.gz
| Download URL | openkache-0.1.3.tar.gz |
|---|---|
| Size | 518.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36e7c84752997df31cc86882ceb335f4c68775bace0f6996fe11503adaeeac10
|
|
BLAKE2b-256 checksum How to use checksums |
d08118649e6f5b31c3efadfdd8423e4dc71ee2be005bd458d099d7a0fb8bd9ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / openkache-0.1.3-py3-none-win_arm64.whl
| Download URL | openkache-0.1.3-py3-none-win_arm64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
bdcb8a38140bcd652a81c6005d4b511a457ab72cd4898c4891c7c2f8d8e3b0b6
|
|
BLAKE2b-256 checksum How to use checksums |
60f1e6bb7bde51684569d4e85579f36d8e656bf1193bdac9ae87983a0b7cc10d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / openkache-0.1.3-py3-none-win_amd64.whl
| Download URL | openkache-0.1.3-py3-none-win_amd64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a2ebf50faecdd53ab932756f1e961448b91d650b404ff07dbcae565050c4d38b
|
|
BLAKE2b-256 checksum How to use checksums |
393fb6bb51d7746f18bce0846d7a6cec1f7315381af4af489dc74f8d35aacd94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / openkache-0.1.3-py3-none-manylinux_2_38_x86_64.whl
| Download URL | openkache-0.1.3-py3-none-manylinux_2_38_x86_64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | Linux glibc 2.38+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
c70c8d923a318af7615e9067153541857960eb3030e684d174fee63aba86d42c
|
|
BLAKE2b-256 checksum How to use checksums |
8c96c2922c91f9bf0838a9780082f61d52d51efe1539d1337dd2b8bd8246dcf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / openkache-0.1.3-py3-none-manylinux_2_38_aarch64.whl
| Download URL | openkache-0.1.3-py3-none-manylinux_2_38_aarch64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | Linux glibc 2.38+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
c16dc6ff1e0fde2c32990d8c7c1a4e3eca8005386c08c8ed5140f7ba856a50b9
|
|
BLAKE2b-256 checksum How to use checksums |
c2f22946a80b71c058465f454808964842a638d9214d0796a3897f7fb0be3371
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / openkache-0.1.3-py3-none-macosx_11_0_arm64.whl
| Download URL | openkache-0.1.3-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5aab9553a55fa595ce887a58efc4bf2ec3cbfaa9ecf29da30ea7faab5bd68d5e
|
|
BLAKE2b-256 checksum How to use checksums |
ee13769e57b9f1c96f36c028420724da2e255a89ca0806325bc7674c727765ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / openkache-0.1.3-py3-none-macosx_10_13_x86_64.whl
| Download URL | openkache-0.1.3-py3-none-macosx_10_13_x86_64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | Python 3 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
ac4c7873925dc6a634c47bb3ec69e47d4f67ca918aee97c3be126d8a8a632542
|
|
BLAKE2b-256 checksum How to use checksums |
e15c42933d5ab109d42d41f02738c1e5c86dc1f270e638f065e668664feca862
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logSecurity for openkache 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 7 files in this release have been uploaded with provenance metadata.
Attestation for openkache-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.