Skip to main content

Python bindings for the foyer Rust hybrid cache library.

Project description

foyer-py

Python bindings for the Rust foyer hybrid cache library.

foyer-py is published on PyPI and imported as foyer.

Current status

  • Sync in-memory cache bindings are available.
  • Sync hybrid cache bindings are available (internally uses Tokio).
  • Native async APIs are available for both cache types.
  • Keys: bytes, str, int.
  • Values: bytes.

Quick start

import foyer

cache = foyer.Cache(16)
cache.insert("hello", b"world")

assert cache.get("hello") == b"world"
assert cache.contains("hello")
assert cache.entries == 1

Hybrid cache (sync API)

import tempfile
import foyer

with tempfile.TemporaryDirectory() as path:
    cache = foyer.HybridCache(path, memory_capacity=64 * 1024 * 1024, storage_capacity=256 * 1024 * 1024)
    cache.insert(42, b"The answer")
    assert cache.get(42) == b"The answer"
    cache.close()

Async APIs

import asyncio
import tempfile
import foyer


async def main() -> None:
    cache = foyer.AsyncCache(16)
    await cache.insert("hello", b"world")
    assert await cache.get("hello") == b"world"

    with tempfile.TemporaryDirectory() as path:
        hybrid = await foyer.AsyncHybridCache.create(path)
        await hybrid.insert(42, b"The answer")
        assert await hybrid.get(42) == b"The answer"
        await hybrid.close()


asyncio.run(main())

Wheel coverage

GitHub Actions builds wheels for:

  • Linux: x86_64, aarch64 (manylinux)
  • macOS: universal2 (Intel + Apple Silicon)
  • Windows: x86_64

Releases are published from tags matching v* (for example v0.0.3).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foyer_py-0.0.6.tar.gz (15.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

foyer_py-0.0.6-cp312-abi3-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.12+Windows x86-64

foyer_py-0.0.6-cp312-abi3-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ x86-64

foyer_py-0.0.6-cp312-abi3-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

foyer_py-0.0.6-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (3.0 MB view details)

Uploaded CPython 3.12+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file foyer_py-0.0.6.tar.gz.

File metadata

  • Download URL: foyer_py-0.0.6.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for foyer_py-0.0.6.tar.gz
Algorithm Hash digest
SHA256 1ac122b1aa0e30d59ed883e098e3559c0c8a1a2ebba715e9fc9e6c7802f1f42a
MD5 0b07885e9e589163bbe734424da589eb
BLAKE2b-256 17af9bd09c8d8234e3da95e04c5c49c07e1aecefe92a6719a733fba63b58a3a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for foyer_py-0.0.6.tar.gz:

Publisher: release.yml on icestreamlabs/foyer-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file foyer_py-0.0.6-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: foyer_py-0.0.6-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for foyer_py-0.0.6-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 82b838b674bb1bdb54f1cfe61f502469ffb6484b0d7a3e1257e7172abc53e5a1
MD5 4ce6a8e54941b0cc1a2731d02eccb4c1
BLAKE2b-256 5d0c516913f8a6e30e585315707be71512dd33e2e6c25230dc241b4e4dd46885

See more details on using hashes here.

Provenance

The following attestation bundles were made for foyer_py-0.0.6-cp312-abi3-win_amd64.whl:

Publisher: release.yml on icestreamlabs/foyer-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file foyer_py-0.0.6-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for foyer_py-0.0.6-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aba0b95ad3f5cefdf2e75116fbbb1a37a144318220260be23c9ff51270f040c3
MD5 99397db6a1168bcd7233495a9e8003cc
BLAKE2b-256 6f574905371ad370282df8907b88833caebca38bad7217014f24c19f287d17a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for foyer_py-0.0.6-cp312-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on icestreamlabs/foyer-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file foyer_py-0.0.6-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for foyer_py-0.0.6-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2d476756d5d849631e5f4638d22d63ecffeb2e9df29b0cc485d304d45d64df0c
MD5 29c1338702fb06901cfb1e2816583f43
BLAKE2b-256 308cecbc7f066e5a96dda784c1d0493612d3315e60e8480c7b9320a240220b74

See more details on using hashes here.

Provenance

The following attestation bundles were made for foyer_py-0.0.6-cp312-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on icestreamlabs/foyer-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file foyer_py-0.0.6-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for foyer_py-0.0.6-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 93739ef90e48a0d052cf2fb910544c8bfd3c1997d895ad2dc10aed048b6861e0
MD5 09dd3d309def8ccb16c56a67d47ba1cc
BLAKE2b-256 c1dcfb2b3e4fdc76fbf80c5d6a378b95778d1e53166e275e0e0331c06dff2f32

See more details on using hashes here.

Provenance

The following attestation bundles were made for foyer_py-0.0.6-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on icestreamlabs/foyer-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page