rust-py-cache 0.1.1__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/Cargo.lock +1 -1
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/Cargo.toml +1 -1
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/PKG-INFO +3 -1
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/README.md +2 -0
- rust_py_cache-0.1.3/ROADMAP.md +90 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/pyproject.toml +1 -1
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/python/rust_py_cache/__init__.py +1 -1
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/.github/workflows/ci.yml +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/.github/workflows/release.yml +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/.gitignore +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/PUBLISHING.md +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/examples/django_example.py +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/examples/fastapi_example.py +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/python/rust_py_cache/decorators.py +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/src/cache.rs +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/src/entry.rs +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/src/lib.rs +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/src/stats.rs +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/src/ttl.rs +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/tests/test_cache_basic.py +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/tests/test_delete.py +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/tests/test_features.py +0 -0
- {rust_py_cache-0.1.1 → rust_py_cache-0.1.3}/tests/test_set_get.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rust-py-cache
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
@@ -29,6 +29,8 @@ process.
|
|
|
29
29
|
[](https://pypi.org/project/rust-py-cache/)
|
|
30
30
|
[](./LICENSE)
|
|
31
31
|
|
|
32
|
+
🌐 **Website:** [rust-py-cache.vercel.app](https://rust-py-cache.vercel.app/)
|
|
33
|
+
|
|
32
34
|
## Installation
|
|
33
35
|
|
|
34
36
|
```bash
|
|
@@ -11,6 +11,8 @@ process.
|
|
|
11
11
|
[](https://pypi.org/project/rust-py-cache/)
|
|
12
12
|
[](./LICENSE)
|
|
13
13
|
|
|
14
|
+
🌐 **Website:** [rust-py-cache.vercel.app](https://rust-py-cache.vercel.app/)
|
|
15
|
+
|
|
14
16
|
## Installation
|
|
15
17
|
|
|
16
18
|
```bash
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Roadmap — rust-py-cache
|
|
2
|
+
|
|
3
|
+
Direction for `rust-py-cache`: an ultra-fast, process-local cache for Python with
|
|
4
|
+
a Rust core (PyO3 + maturin). The MVP is intentionally small; this document tracks
|
|
5
|
+
the stages already shipped and what comes next.
|
|
6
|
+
|
|
7
|
+
> Status legend: ✅ shipped · 🔜 planned (next) · 💡 idea (no version yet) · ⚠️ note
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Shipped — v0.1.x (current: 0.1.2)
|
|
12
|
+
|
|
13
|
+
- ✅ `Cache` with `set` / `get(default=...)` / `delete` / `exists` / `keys` /
|
|
14
|
+
`len` / `clear` / `cleanup_expired` / `stats`.
|
|
15
|
+
- ✅ TTL per entry with **lazy expiration** (expired keys are dropped on access or
|
|
16
|
+
via `cleanup_expired()`).
|
|
17
|
+
- ✅ Cumulative `stats()` (`hits, misses, sets, deletes, expired, size`) backed by
|
|
18
|
+
`AtomicU64` — no global lock on the hot path.
|
|
19
|
+
- ✅ Memoization decorator `@cache.cached(ttl=..., key=...)` (fixed string or
|
|
20
|
+
callable key).
|
|
21
|
+
- ✅ Rust core on `DashMap` (per-shard locks); values serialized with `pickle` and
|
|
22
|
+
stored as opaque bytes (`Vec<u8>`).
|
|
23
|
+
- ✅ Examples for FastAPI and Django.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Planned
|
|
28
|
+
|
|
29
|
+
### v0.2 — Background expiration
|
|
30
|
+
|
|
31
|
+
- 🔜 Optional background sweeper thread to reclaim expired entries proactively,
|
|
32
|
+
configurable via the constructor (e.g. `Cache(cleanup_interval=...)`), instead
|
|
33
|
+
of relying only on lazy expiration / manual `cleanup_expired()`.
|
|
34
|
+
- 🔜 Keep the sweeper opt-in and lock-friendly (sweep shard by shard) so it never
|
|
35
|
+
stalls the hot path.
|
|
36
|
+
|
|
37
|
+
### v0.3 — LRU eviction
|
|
38
|
+
|
|
39
|
+
- 🔜 `Cache(max_size=...)` with **least-recently-used** eviction once the cap is hit.
|
|
40
|
+
- 🔜 Track recency cheaply (avoid a global lock); surface evictions in `stats()`
|
|
41
|
+
(e.g. an `evicted` counter).
|
|
42
|
+
|
|
43
|
+
### v0.4 — LFU eviction
|
|
44
|
+
|
|
45
|
+
- 🔜 **Least-frequently-used** eviction policy as an alternative to LRU, selectable
|
|
46
|
+
at construction time (e.g. `Cache(max_size=..., policy="lfu")`).
|
|
47
|
+
|
|
48
|
+
### v0.5 — Configurable serializer
|
|
49
|
+
|
|
50
|
+
- 🔜 Pluggable serialization instead of hard-coded `pickle`: e.g.
|
|
51
|
+
`Cache(serializer="json" | "pickle" | "msgpack")` or a custom
|
|
52
|
+
encode/decode pair.
|
|
53
|
+
- ⚠️ Security: `pickle` must not deserialize untrusted data — a JSON/MessagePack
|
|
54
|
+
option makes the cache safe to share across trust boundaries.
|
|
55
|
+
|
|
56
|
+
### v0.6 — Namespaces
|
|
57
|
+
|
|
58
|
+
- 🔜 Logical key namespaces (e.g. `cache.namespace("users")`) so independent
|
|
59
|
+
features can share one `Cache` instance without key collisions, with per-namespace
|
|
60
|
+
`clear()` and stats.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Ideas / future (no version assigned)
|
|
65
|
+
|
|
66
|
+
- 💡 Prometheus metrics exporter (align with `rust-py-monitor`).
|
|
67
|
+
- 💡 Redis synchronization / a distributed tier (today the cache is process-local).
|
|
68
|
+
- 💡 ImmutableLog integration for eviction events
|
|
69
|
+
(`{"event_type": "cache_evicted", "key": ..., "reason": ...}`).
|
|
70
|
+
- 💡 Binary value formats end-to-end (MessagePack / CBOR / Bincode) for smaller,
|
|
71
|
+
faster payloads.
|
|
72
|
+
- 💡 Benchmarks suite (throughput vs. `dict`, `cachetools`, in-process Redis).
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Known limitations (by design, for now)
|
|
77
|
+
|
|
78
|
+
- Process-local: multiple workers = multiple independent caches.
|
|
79
|
+
- Not a replacement for Redis in distributed setups.
|
|
80
|
+
- Data is lost on process restart.
|
|
81
|
+
- Lazy TTL: expired items may linger until accessed or `cleanup_expired()` runs
|
|
82
|
+
(addressed by v0.2).
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Contributing to the roadmap
|
|
87
|
+
|
|
88
|
+
Versions and ordering are indicative and may shift. Bump the version in **both**
|
|
89
|
+
`Cargo.toml` and `pyproject.toml` (kept in sync) plus `__version__`, ship tests
|
|
90
|
+
(`cargo test` + `pytest`), then tag `vX.Y.Z` to trigger the release workflow.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|