semvec/pypi-packages huggingface dataset:
preserve 1.2.1
A simple key/value store with multiple backends.
License: MIT
Requires Python: <4.0,>=3.9

# 🥫 Preserve - A simple Python Key/Value database with multiple backends.

> ⚠️ Preserve is alpha software and currently in development (i.e., no tests).

Preserve is a simple (simplistic) key/value store for storing JSON-like data in different backends. Its API is based on the standard Python dictionary API.

## ℹ️ Installation and Usage

Preserve can be installed using pip:

```
pip install preserve
```

Preserve can be also installed from Github directly using the following command:

```
pip install git+https://github.com/evhart/preserve#egg=preserve
```

### 📒 Requirements

Preserve needs the following libraries installed and Python 3.6+ (tested on Python 3.8):
* [halo](https://github.com/manrajgrover/halo)
* [pydantic](https://pydantic-docs.helpmanual.io/)
* [tabulate](https://github.com/astanin/python-tabulate)
* [typer](https://typer.tiangolo.com/)

Optioanal dependencies for specific backends:
* [pymongo](https://pymongo.readthedocs.io/)

### 🐍 Python API

If you know how to use Python dictionaries, you already know how to use preserve. Simply use the backend connector that corresponds to your database and you are ready to go.

You can either create a new database from a standarised database URI or using the driver parameters:

```python
import preserve

# Using parameters:
jam_db1 = preserve.open('shelf', filename="preserve.dbm")
jam_db1['strawberry'] = {'name': 'Strawbery Jam', 'ingredients': ['strawberry', 'sugar']}

# Using URI:
jam_db2 = preserve.from_uri("mongodb://127.0.0.1:27017/preserves?collection=jam")
jam_db2['currant'] = {'name': 'Currant Jam', 'ingredients': ['currant', 'sugar']}

```

### 🖥️ Command Line Interface (CLI)

Preserve has a simple CLI utility that can be access using the `` `preserve` `` command. Preserve support migrating/exporting data from one database ot another database and showing the firs rows from databases.

```
Usage: preserve [OPTIONS] COMMAND [ARGS]...

  🥫 Preserve - A simple Key/Value database with multiple backends.

Options:
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.

  --help                          Show this message and exit.

Commands:
  connectors  List available connectors.
  export      Export a database to a different output.
  header      Get header of a given database table.
```
ai-cachekit 1.0.0
Universal caching system for AI responses with support for memory, file (JSON), and Redis backends.
License: MIT
Requires Python: >=3.8
Keywords: cache, redis, ai, memory, file, sqlite

# AI CacheKit

[![Tests](https://github.com/EDLadder/ai-cachekit/actions/workflows/python-tests.yml/badge.svg)](https://github.com/EDLadder/ai-cachekit/actions)
[![PyPI version](https://badge.fury.io/py/ai-cachekit.svg)](https://badge.fury.io/py/ai-cachekit)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Lightweight caching library for AI/LLM API responses.  
Reduce costs and improve performance by storing API responses locally with hash-based keys and optional TTL.

---

## Features
- 🔹 Simple API: `get`, `set`
- 🔹 Local JSON storage (no external DB required)
- 🔹 Optional TTL (time-to-live) for cache expiration
- 🔹 Perfect for OpenAI, Anthropic, Ollama, etc.

---

## Installation

**From GitHub (development version):**
```bash
pip install git+https://github.com/EDLadder/ai-cachekit.git
```

**From PyPI (after release):**
```bash
pip install ai-cachekit
```

---

## Usage

```python
from ai_cachekit import AIResponseCache

cache = AIResponseCache(backend="memory")
cache.set("question", "answer")
print(cache.get("question"))
```

### File-Based Cache (JSON)

```python
cache = AIResponseCache(backend="file", filepath="my_cache.json")
cache.set("key", "value")
print(cache.get("key"))
```

### Redis Cache

```python
cache = AIResponseCache(backend="redis", host="localhost", port=6379)
cache.set("key", "value")
print(cache.get("key"))
```

---

## Why?
- Avoid repeated API calls (save cost & time)
- Minimal dependencies and setup
- Flexible for any AI API (OpenAI, LLaMA, etc.)

---

## Development

Clone repo and install dev dependencies:
```bash
git clone https://github.com/EDLadder/ai-cachekit.git
cd ai-cachekit
pip install -r requirements.txt
pytest
```

---

## Plans
- [x] Support for Redis and SQLite backends.
- [ ] CLI tool for managing cache.
- [ ] Built-in stats: hit rate, saved cost estimation.
- [ ] Encryption for cached data.

---

## License
MIT License – free to use and modify.