Skip to main content

PySynCache

Python bindings for SynCache — an in-process distributed cache that stores data directly in your application's heap memory while keeping every instance in the cluster automatically in sync.

PyPI version Python License: MIT


Why SynCache?

Traditional distributed caches (Redis, Memcached) require a network round-trip on every read. SynCache eliminates that entirely — reads come straight from the same heap your application runs in, with no kernel syscalls or context switches.

Operation SynCache Traditional Remote Cache
Read 197× faster baseline
Write 8× faster baseline
Eviction 18× faster baseline

Writes still sync across the cluster through a lightweight broker, so every instance stays consistent without you managing any pub/sub logic.


How It Works

  Instance A          Instance B          Instance C
 ┌──────────┐        ┌──────────┐        ┌──────────┐
 │ In-proc  │        │ In-proc  │        │ In-proc  │
 │  Cache   │        │  Cache   │        │  Cache   │
 └────┬─────┘        └────┬─────┘        └────┬─────┘
      │                   │                   │
      └───────────────────┼───────────────────┘
                          │
                  ┌───────┴────────┐
                  │ SynCache Broker │
                  └────────────────┘
  • Reads bypass the broker entirely — served directly from process memory
  • Writes propagate through the broker to all instances using the affected namespace
  • Evictions broadcast cluster-wide automatically

Installation

pip install pysyncache

Requires Python 3.7+. Supported on Linux, macOS, and Windows (x64 and arm64).


Getting a Token

SynCache requires a broker token to connect your instances.

  1. Visit syncache.tabariyya.com
  2. Submit your name, email, and project name
  3. Receive your token instantly via email
  4. Store it as an environment variable:
export SYNCACHE_TOKEN=your_token_here

The free tier supports up to 5 connected instances with full API access. No credit card required.


Quick Start

import os
from SynCache import Cache

# Initialize once at application startup
Cache.initialize(
    broker_auth_token=os.getenv("SYNCACHE_TOKEN"),
    max_entries=1000
)

# Store a value (syncs to all instances)
Cache.set("users", "user:1", {"name": "Alice", "role": "admin"})

# Read directly from local memory (no network)
user = Cache.get("users", "user:1")

# Evict a single entry across the cluster
Cache.evict("users", "user:1")

# Evict an entire namespace across the cluster
Cache.evict_all("users")

Decorators

PySynCache ships with decorators that mirror the familiar @Cacheable / @CachePut / @CacheEvict pattern.

from SynCache.decorators import Cacheable, CachePut, CacheEvict

@Cacheable(namespace="users", ttl=60)
def get_user(user_id: str) -> dict:
    # Only called on a cache miss — result cached automatically
    return db.fetch_user(user_id)

@CachePut(namespace="users")
def update_user(user_id: str, data: dict) -> dict:
    # Result written to cache and synced across the cluster
    return db.update_user(user_id, data)

@CacheEvict(namespace="users")
def delete_user(user_id: str) -> None:
    # Entry evicted from all instances on return
    db.delete_user(user_id)

Configuration

Parameter Type Description
broker_auth_token str Token from your SynCache account
max_entries int Maximum number of entries held in process memory

TTL (time-to-live) is configured per entry in seconds. Entries without a TTL persist until evicted.


Consistency Model

Scenario Behaviour
Local read after local write Strong consistency — immediately visible
Cross-instance propagation Eventual consistency with sub-millisecond sync
Namespace scoping Updates only reach instances actively using that namespace

Metadata

Release files for pysyncache 1.0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysyncache 1.0.5.1
File Size Uploaded Provenance Actions
pysyncache-1.0.5.1.tar.gz 86.4 MB Without provenance Details for pysyncache-1.0.5.1.tar.gz

Release files / pysyncache-1.0.5.1.tar.gz

Download URL pysyncache-1.0.5.1.tar.gz
Size 86.4 MB
Tags Source
SHA-256 checksum
How to use checksums
aa26b288ef342d8810743507bd22286b8d7773eee6eb7a2cf9c407e33ce9cdb8
BLAKE2b-256 checksum
How to use checksums
ac8f4ca237749f4bf1a2c74d8ef3b23bf9d9ac35645160563d5d38e1635751ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for pysyncache 1.0.5.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page