Skip to main content

Sipora Server Catchers

A lightweight, Python-based distributed in-memory caching server and client library.

Sipora Server Catchers is designed to provide fast key-value caching for Python applications without requiring Redis as a dependency.

Features

  • 🚀 Fast in-memory caching
  • 🌐 Remote cache server
  • 🐍 Native Python client
  • ⏱️ Key expiration with TTL
  • 🔢 Increment and decrement counters
  • 🗑️ Delete cached values
  • 🔍 Check whether a key exists
  • 🔌 TCP-based client/server communication
  • 📦 Easy installation through PyPI
  • ⚡ Designed for FastAPI and Python applications
  • 🧩 Lightweight architecture
  • 🔒 Authentication support can be added
  • 📊 Memory eviction support

Architecture

                    Python Application
                           │
                           │
                           ▼
                ┌─────────────────────┐
                │    Sipora Client    │
                │                     │
                │  set()              │
                │  get()              │
                │  delete()           │
                │  exists()           │
                │  expire()           │
                │  increment()        │
                └──────────┬──────────┘
                           │
                           │ TCP
                           ▼
                ┌─────────────────────┐
                │ Sipora Cache Server │
                │                     │
                │    Memory Storage   │
                │                     │
                │    TTL Manager      │
                │                     │
                │    Eviction         │
                └──────────┬──────────┘
                           │
                           │ Cache MISS
                           ▼
                ┌─────────────────────┐
                │     SQL / MongoDB   │
                │      / Database     │
                └─────────────────────┘

Installation

Install from PyPI:

pip install sipora-server-catchers

Quick Start

Start the Server

After installation, start the Sipora cache server:

sipora-cache-server

By default, the server will listen on:

127.0.0.1:6380

You can specify a custom host and port:

sipora-cache-server --host 0.0.0.0 --port 6380

Python Client

Connect to the cache server:

from sipora_server_catchers import CacheClient

cache = CacheClient(
    host="127.0.0.1",
    port=6380
)

Set a Value

cache.set("name", "Mahesh")

Get a Value

name = cache.get("name")

print(name)

Output:

Mahesh

Delete a Value

cache.delete("name")

Check if a Key Exists

if cache.exists("name"):
    print("Key exists")

TTL

You can automatically expire cached data.

cache.set(
    "otp:12345",
    "987654",
    ttl=60
)

The key will automatically expire after 60 seconds.

You can check the remaining TTL:

remaining = cache.ttl("otp:12345")

print(remaining)

Counters

Increment a numeric value:

cache.increment("page_views")

Increment by a specific amount:

cache.increment(
    "page_views",
    amount=10
)

Get the value:

views = cache.get("page_views")

print(views)

Using With FastAPI

Sipora Server Catchers can be used as a caching layer in FastAPI applications.

from fastapi import FastAPI
from sipora_server_catchers import CacheClient

app = FastAPI()

cache = CacheClient(
    host="127.0.0.1",
    port=6380
)


@app.get("/product/{product_id}")
def get_product(product_id: int):

    cache_key = f"product:{product_id}"

    cached_product = cache.get(cache_key)

    if cached_product is not None:
        return {
            "source": "cache",
            "data": cached_product
        }

    # Query your database here
    product = {
        "id": product_id,
        "name": "Example Product",
        "price": 100
    }

    cache.set(
        cache_key,
        product,
        ttl=300
    )

    return {
        "source": "database",
        "data": product
    }

Cache-Aside Pattern

Sipora is designed to work well with the cache-aside pattern.

             Request
                │
                ▼
          ┌───────────┐
          │  FastAPI  │
          └─────┬─────┘
                │
                ▼
          ┌───────────┐
          │  Sipora   │
          │   Cache   │
          └─────┬─────┘
                │
          ┌─────┴─────┐
          │           │
        HIT          MISS
          │           │
          ▼           ▼
       Return      Database
       cached         │
       data           ▼
                  Store in
                    cache
                      │
                      ▼
                   Return

This prevents frequently requested data from repeatedly hitting the database.

Remote Cache Server

The cache server can run on another machine.

For example:

Application Server
10.0.0.10
      │
      │ TCP
      ▼
Sipora Cache Server
10.0.0.20:6380

Connect remotely:

from sipora_server_catchers import CacheClient

cache = CacheClient(
    host="10.0.0.20",
    port=6380
)

This allows multiple application servers to share the same cache.

                ┌─────────────────┐
                │ Sipora Cache    │
                │ 10.0.0.20:6380  │
                └────────┬────────┘
                         │
              ┌──────────┼──────────┐
              │          │          │
              ▼          ▼          ▼
          Server 1    Server 2    Server 3

Supported Commands

Current commands:

Command Description
GET Get a cached value
SET Store a value
DELETE Delete a value
EXISTS Check whether a key exists
EXPIRE Set expiration
TTL Get remaining expiration
INCREMENT Increment a numeric value
DECREMENT Decrement a numeric value

Project Structure

sipora-server-catchers/
│
├── pyproject.toml
├── README.md
├── LICENSE
├── .gitignore
├── CHANGELOG.md
│
├── src/
│   └── sipora_server_catchers/
│       │
│       ├── __init__.py
│       ├── version.py
│       │
│       ├── client/
│       │   ├── __init__.py
│       │   ├── client.py
│       │   ├── connection.py
│       │   └── exceptions.py
│       │
│       ├── server/
│       │   ├── __init__.py
│       │   ├── server.py
│       │   ├── connection.py
│       │   ├── protocol.py
│       │   └── handlers.py
│       │
│       ├── storage/
│       │   ├── __init__.py
│       │   ├── memory.py
│       │   ├── item.py
│       │   └── eviction.py
│       │
│       ├── ttl/
│       │   ├── __init__.py
│       │   └── manager.py
│       │
│       ├── serialization/
│       │   ├── __init__.py
│       │   └── serializer.py
│       │
│       ├── commands/
│       │   ├── __init__.py
│       │   ├── get.py
│       │   ├── set.py
│       │   ├── delete.py
│       │   ├── exists.py
│       │   ├── expire.py
│       │   └── increment.py
│       │
│       ├── config/
│       │   ├── __init__.py
│       │   └── settings.py
│       │
│       └── utils/
│           ├── __init__.py
│           └── logger.py
│
├── tests/
│
└── examples/

Development

Clone the repository:

git clone https://github.com/YOUR_USERNAME/sipora-server-catchers.git

Enter the project:

cd sipora-server-catchers

Create a virtual environment:

python -m venv .venv

Activate it on Windows:

.venv\Scripts\Activate.ps1

Activate it on Linux/macOS:

source .venv/bin/activate

Install development dependencies:

pip install -e ".[dev]"

Run tests:

pytest

Build Package

Build the PyPI package:

python -m build

The generated files will be placed in:

dist/

You should see:

dist/
├── sipora_server_catchers-0.1.0-py3-none-any.whl
└── sipora_server_catchers-0.1.0.tar.gz

Check the package:

twine check dist/*

Publishing to TestPyPI

Upload to TestPyPI first:

twine upload --repository testpypi dist/*

Then test installation:

pip install \
    --index-url https://test.pypi.org/simple/ \
    sipora-server-catchers

Publishing to PyPI

After testing:

twine upload dist/*

Users will then be able to install the package with:

pip install sipora-server-catchers

Security

Do not expose the cache server directly to the public internet without authentication, encryption, and appropriate network restrictions.

For production deployments, use:

  • Firewall rules
  • Private networking
  • Authentication
  • TLS
  • Access control
  • Monitoring
  • Resource limits

Roadmap

Version 0.1

  • Project structure
  • TCP server
  • Python client
  • GET
  • SET
  • DELETE
  • EXISTS
  • TTL
  • INCREMENT

Version 0.2

  • Async client
  • Async server
  • Connection pooling
  • Authentication
  • Better serialization
  • Memory limits

Version 0.3

  • LRU eviction
  • Persistence
  • Monitoring
  • Metrics
  • Health checks

Future

  • Replication
  • High availability
  • Cluster support
  • Pub/Sub
  • Distributed locking

License

This project is licensed under the MIT License.

See the LICENSE file for details.

Author

Sipora

Project:

sipora-server-catchers

Python package:

sipora_server_catchers

Download files

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

Source Distribution

sipora_server_catchers-0.1.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

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

sipora_server_catchers-0.1.0-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file sipora_server_catchers-0.1.0.tar.gz.

File metadata

  • Download URL: sipora_server_catchers-0.1.0.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sipora_server_catchers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0536f421a3dbf190d76605d462c1dfeb16f02c542192eeef16c3c53bab469c9b
MD5 55babbcfbfe1fb8c56347b48920f6b82
BLAKE2b-256 47552870e80d68f2fa81d62d90645d63155dfaf60dadc9ccace806d243500f90

See more details on using hashes here.

Provenance

The following attestation bundles were made for sipora_server_catchers-0.1.0.tar.gz:

Publisher: deploy.yml on brandoraa/sipora_server_catchers

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

File details

Details for the file sipora_server_catchers-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sipora_server_catchers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e66cc79c787107849fddb6ffa233aa7642c296a610098ad7bd3eba3c9026006a
MD5 7ad7447af51378041bd75ba882a7452b
BLAKE2b-256 e9e0820e9f9636d7c97792d6872126b158c4654e4280c00ed481fafbdc5465af

See more details on using hashes here.

Provenance

The following attestation bundles were made for sipora_server_catchers-0.1.0-py3-none-any.whl:

Publisher: deploy.yml on brandoraa/sipora_server_catchers

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

Release history Release notifications | RSS feed

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

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