Metadata-Version: 2.4
Name: cachly
Version: 0.1.0
Summary: Official Python SDK for cachly.dev – Managed Valkey/Redis cache with semantic AI caching
Project-URL: Homepage, https://cachly.dev
Project-URL: Documentation, https://docs.cachly.dev
Project-URL: Repository, https://github.com/cachly-dev/cachly-python
Project-URL: Bug Tracker, https://github.com/cachly-dev/cachly-python/issues
License: Apache-2.0
Keywords: cache,cachly,dsgvo,eu,llm,redis,semantic-cache,valkey
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Requires-Dist: redis>=5.0.0
Provides-Extra: dev
Requires-Dist: datamodel-code-generator>=0.25; extra == 'dev'
Requires-Dist: fakeredis>=2.21; extra == 'dev'
Requires-Dist: numpy>=1.26; extra == 'dev'
Requires-Dist: pydantic>=2.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# Stop Rebuilding Context. Start Shipping Faster.

> **cachly Python SDK** — The cache that remembers everything so your AI assistant doesn't have to start from scratch every morning.

[![PyPI](https://img.shields.io/pypi/v/cachly?color=blue&logo=pypi)](https://pypi.org/project/cachly/)
[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue?logo=python)](https://pypi.org/project/cachly/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)
[![GDPR: EU-only](https://img.shields.io/badge/GDPR-EU%20only-green)](https://cachly.dev/legal)

---

## The Problem Nobody Talks About

You open Cursor. You ask it to continue where you left off. It doesn't know what "where you left off" means.

You explain your architecture. Again.  
You explain why you use that pattern. Again.  
You explain the bug you fixed last Tuesday. Again.

**The average developer wastes 45 minutes per day just re-establishing context with their AI assistant.** That's 3.5 hours a week. 180 hours a year. Gone.

And then there's the infrastructure tax: your AI hits your database for every request. Your LLM bills are exploding. Your p99 is embarrassing. Your GDPR officer won't stop emailing you about US data residency.

---

## cachly fixes both.

**Two products. One connection string. Zero ops.**

---

## 🧠 AI Dev Brain — Your AI Assistant's Permanent Memory

Give Claude Code, Cursor, GitHub Copilot, and Windsurf a brain that persists across every session, every machine, every restart:

```bash
npx @cachly-dev/init
```

From this moment, your AI assistant will:
- Remember every bug fix and the exact command that solved it
- Know your architecture without you explaining it again
- Resume work exactly where you left off, every single session
- Reuse known solutions instead of re-researching — saving ~1,200 tokens per recall

**Before cachly:** "Let me analyze your codebase... reading 47 files..."  
**After cachly:** "Last session: deployed blue/green API, 23 lessons stored. Ready."


Configure in `~/.vscode/mcp.json`, `.cursor/mcp.json`, or `.mcp.json`:

```json
{
  "servers": {
    "cachly": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@cachly-dev/mcp-server"],
      "env": { "CACHLY_JWT": "your-jwt-token" }
    }
  }
}
```

→ Full docs: [cachly.dev/docs/ai-memory](https://cachly.dev/docs/ai-memory)

---

## ⚡ Managed Cache — Sub-millisecond, GDPR-Compliant, German Servers

### Installation

```bash
pip install cachly
# or
uv add cachly
```

### Quick Start

```python
import os
from cachly import CachlyClient

cache = CachlyClient(url=os.environ["CACHLY_URL"])

# Cache LLM responses, user sessions, computed results
cache.set("user:42", {"name": "Alice"}, ttl=300)
user = cache.get("user:42")

# Get-or-Set: never hit the DB twice
report = cache.get_or_set("report:monthly", lambda: db.run_expensive_report(), ttl=3600)

# Atomic counter
views = cache.incr("page:views")

cache.close()
```

**[Create your free instance →](https://cachly.dev)** No credit card. Live in 30 seconds.

---

## With vs. Without cachly

| Situation | Without cachly | With cachly |
|-----------|----------------|-------------|
| AI session start | 5–10 min re-explaining context | < 10 sec, full context loaded |
| Same DB query, 1000 req/s | 1,000 DB hits | 1 DB hit, 999 cache hits |
| LLM API costs for repeated prompts | Pay every time | Pay once, cache the rest |
| GDPR compliance for EU users | Data leaves EU (US Redis) | Data stays in Germany, always |
| Infra setup | Days of ops work | 30 seconds, zero ops |
| Architecture knowledge after holiday | Starts from zero | Fully briefed in seconds |
| Debugging a known issue | Re-research from scratch | Instant: "you fixed this on March 12" |
| p99 latency (uncached) | 200–800ms (DB) | < 1ms (cache hit) |

---

## Semantic Cache — Cut LLM Costs by 40–70%

Stop paying for the same answer twice:

```python
sem = cache.semantic_cache(embed_fn=openai.embed, threshold=0.92, ttl=86400)

result = sem.get(user_query)
if result is None:
    answer = call_your_llm(user_query)
    sem.set(user_query, answer)
```

---

## 👥 Team Brain — Shared AI Memory for Your Whole Team

One shared instance. Every developer gets smarter every day.

```python
# .env — same instance for the whole team
CACHLY_INSTANCE_ID=your-shared-team-instance

# Alice fixes a bug, stores the lesson:
brain.learn_from_attempts(
    topic="deploy:k8s-timeout",
    outcome="success",
    what_worked="Increase readinessProbe.failureThreshold to 10",
    author="alice"
)

# Bob starts a session the next day:
brain.session_start()
# → "💡 alice solved deploy:k8s-timeout 1d ago: Increase readinessProbe..."
```

Set up a team org at [cachly.dev/teams](https://cachly.dev/teams) — Team €99/mo · 10 seats · Business €299/mo · 50 seats.

---

## Pricing

| Tier | RAM | Price | Best for |
|------|-----|-------|----------|
| **Free** | 25 MB | €0/mo | Dev & side projects |
| **Dev** | 200 MB | €19/mo | Startups, small apps |
| **Pro** | 900 MB | €49/mo | Production workloads |
| **Speed** | 900 MB Dragonfly + Semantic Cache | €79/mo | AI apps, high QPS |
| **Business** | 7 GB | €199/mo | Scale-ups |

All plans: **German servers · GDPR-compliant · No US data transfer · 99.9% SLA**

---

## Links

- [cachly.dev](https://cachly.dev) — Dashboard & free signup
- [PyPI](https://pypi.org/project/cachly/) — Package
- [AI Brain docs](https://cachly.dev/docs/ai-memory) — MCP server setup
- [GitHub](https://github.com/cachly-dev/sdk-python)
