diskcache-rs 0.4.5__tar.gz → 0.4.6__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.
- diskcache_rs-0.4.6/.release-please-manifest.json +3 -0
- diskcache_rs-0.4.6/API_COMPATIBILITY.md +442 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/CHANGELOG.md +13 -1
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/Cargo.lock +251 -36
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/Cargo.toml +3 -3
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/PKG-INFO +3 -3
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/python/diskcache_rs/__init__.py +3 -1
- diskcache_rs-0.4.6/python/diskcache_rs/__init__.pyi +502 -0
- diskcache_rs-0.4.6/python/diskcache_rs/cache.py +2774 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/python/diskcache_rs/fast_cache.py +15 -2
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/cache.rs +18 -6
- diskcache_rs-0.4.6/tests/test_complete_api_gaps.py +597 -0
- diskcache_rs-0.4.6/tests/test_full_api_compatibility.py +656 -0
- diskcache_rs-0.4.6/tests/test_issue_73_deterministic_hashing.py +386 -0
- diskcache_rs-0.4.6/tests/test_issue_78_expire_method.py +262 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/uv.lock +7 -7
- diskcache_rs-0.4.5/.release-please-manifest.json +0 -3
- diskcache_rs-0.4.5/API_COMPATIBILITY.md +0 -333
- diskcache_rs-0.4.5/python/diskcache_rs/__init__.pyi +0 -215
- diskcache_rs-0.4.5/python/diskcache_rs/cache.py +0 -1135
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/actions/build-and-test/action.yml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/actions/setup-diskcache-rs/action.yml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/pull_request_template.md +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/workflows/benchmark.yml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/workflows/build-abi3.yml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/workflows/build.yml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/workflows/ci.yml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.github/workflows/release.yml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.gitignore +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/.pre-commit-config.yaml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/Dockerfile.test +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/LICENSE +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/README.md +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/comprehensive_performance_test.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/detailed_profiling.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/final_performance_comparison.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/high_performance_test.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/memory_usage_test.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/micro_benchmark.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/optimization_validation_test.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/performance_comparison.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/precise_benchmark.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/benchmarks/set_performance_analysis.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/docker-compose.test.yml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/examples/basic_usage.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/examples/special_chars_keys_example.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/justfile +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/pyproject.toml +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/python/diskcache_rs/_diskcache_rs.pyi +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/python/diskcache_rs/core.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/python/diskcache_rs/pickle_cache.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/python/diskcache_rs/rust_pickle.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/release-please-config.json +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/renovate.json +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/scripts/generate_stubs.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/scripts/sync_version.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/scripts/test-docker-network.sh +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/error.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/eviction.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/lib.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/memory_cache.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/migration.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/pickle_cache.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/serialization.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/storage/optimized_backend.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/storage/tests.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/storage.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/src/utils.rs +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/__init__.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/benchmark_official.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/conftest.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_api_compatibility.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_basic_operations.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_ci_benchmark.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_compatibility.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_cross_platform_network.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_diskcache_rs_persistence_suite.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_docker_network.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_fast_cache.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_issue_17_configurable_threshold.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_network_filesystem.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_performance.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_pickle_cache.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_rust_pickle_performance.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_special_chars_keys.py +0 -0
- {diskcache_rs-0.4.5 → diskcache_rs-0.4.6}/tests/test_version_and_disk_threshold.py +0 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
# diskcache_rs API Compatibility Report
|
|
2
|
+
|
|
3
|
+
## Executive Summary
|
|
4
|
+
|
|
5
|
+
**Question**: Can developers simply change the namespace from `diskcache` to `diskcache_rs` for a drop-in replacement?
|
|
6
|
+
|
|
7
|
+
**Answer**: ✅ **~100% Compatible** - All core operations, atomic operations, memoization, transactions, iteration, queue operations, sub-cache operations, metadata access, tag-based operations, and pickle serialization are fully compatible.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Cache Class API Comparison
|
|
12
|
+
|
|
13
|
+
### ✅ Fully Compatible Methods (Core API)
|
|
14
|
+
|
|
15
|
+
| Method | diskcache | diskcache_rs | Notes |
|
|
16
|
+
|--------|-----------|--------------|-------|
|
|
17
|
+
| `__init__(directory, timeout, ...)` | ✅ | ✅ | Compatible |
|
|
18
|
+
| `__contains__(key)` | ✅ | ✅ | Compatible |
|
|
19
|
+
| `__getitem__(key)` | ✅ | ✅ | Compatible |
|
|
20
|
+
| `__setitem__(key, value)` | ✅ | ✅ | Compatible |
|
|
21
|
+
| `__delitem__(key)` | ✅ | ✅ | Compatible |
|
|
22
|
+
| `__iter__()` | ✅ | ✅ | Compatible |
|
|
23
|
+
| `__reversed__()` | ✅ | ✅ | Compatible |
|
|
24
|
+
| `__len__()` | ✅ | ✅ | Compatible |
|
|
25
|
+
| `__getstate__()` / `__setstate__()` | ✅ | ✅ | Pickle serialization support |
|
|
26
|
+
| `get(key, default, read, expire_time, tag, ...)` | ✅ | ✅ | Full support including expire_time and tag return |
|
|
27
|
+
| `set(key, value, expire, read, tag, ...)` | ✅ | ✅ | Full support including read=True for file-like objects |
|
|
28
|
+
| `delete(key, retry)` | ✅ | ✅ | Compatible |
|
|
29
|
+
| `add(key, value, expire, ...)` | ✅ | ✅ | Compatible |
|
|
30
|
+
| `pop(key, default, expire_time, tag, ...)` | ✅ | ✅ | Full support including expire_time and tag return |
|
|
31
|
+
| `clear(retry)` | ✅ | ✅ | Compatible |
|
|
32
|
+
| `incr(key, delta, default)` | ✅ | ✅ | Compatible |
|
|
33
|
+
| `decr(key, delta, default)` | ✅ | ✅ | Compatible |
|
|
34
|
+
| `touch(key, expire)` | ✅ | ✅ | Compatible |
|
|
35
|
+
| `expire(now, retry)` | ✅ | ✅ | Compatible |
|
|
36
|
+
| `evict(tag, retry)` | ✅ | ✅ | Full tag-based eviction via Python-side tracking |
|
|
37
|
+
| `stats(enable, reset)` | ✅ | ✅ | Compatible |
|
|
38
|
+
| `volume()` | ✅ | ✅ | Compatible |
|
|
39
|
+
| `close()` | ✅ | ✅ | Compatible |
|
|
40
|
+
| `__enter__()` / `__exit__()` | ✅ | ✅ | Context manager support |
|
|
41
|
+
| `memoize(name, typed, expire, tag, ignore)` | ✅ | ✅ | Compatible |
|
|
42
|
+
| `transact(retry)` | ✅ | ✅ | Compatible |
|
|
43
|
+
| `iterkeys(reverse)` | ✅ | ✅ | Compatible |
|
|
44
|
+
| `peekitem(last, expire_time, tag, retry)` | ✅ | ✅ | Full support including expire_time and tag return |
|
|
45
|
+
| `directory` (property) | ✅ | ✅ | Compatible |
|
|
46
|
+
| `timeout` (property) | ✅ | ✅ | Compatible |
|
|
47
|
+
| `check(fix, retry)` | ✅ | ✅ | Compatible |
|
|
48
|
+
| `cull(retry)` | ✅ | ✅ | Compatible |
|
|
49
|
+
| `reset(key, value)` | ✅ | ✅ | Compatible (settings via constructor) |
|
|
50
|
+
| `read(key, retry)` | ✅ | ✅ | Returns BytesIO handle |
|
|
51
|
+
| `push(value, prefix, side, ...)` | ✅ | ✅ | Queue operations |
|
|
52
|
+
| `pull(prefix, default, side, ...)` | ✅ | ✅ | Queue operations with expire_time/tag support |
|
|
53
|
+
| `peek(prefix, default, side, ...)` | ✅ | ✅ | Queue operations with expire_time/tag support |
|
|
54
|
+
| `create_tag_index()` | ✅ | ✅ | No-op (tags inline) |
|
|
55
|
+
| `drop_tag_index()` | ✅ | ✅ | No-op (tags inline) |
|
|
56
|
+
| `disk` (property) | ✅ | ✅ | Returns compatible proxy |
|
|
57
|
+
| `keys()` | ✅ | ✅ | Compatible |
|
|
58
|
+
| `values()` | ✅ | ✅ | Compatible |
|
|
59
|
+
| `items()` | ✅ | ✅ | Compatible |
|
|
60
|
+
| `vacuum()` | ✅ | ✅ | Compatible |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## FanoutCache Class API Comparison
|
|
65
|
+
|
|
66
|
+
### ✅ Fully Compatible Methods
|
|
67
|
+
|
|
68
|
+
| Method | diskcache | diskcache_rs | Notes |
|
|
69
|
+
|--------|-----------|--------------|-------|
|
|
70
|
+
| `__init__(directory, shards, ...)` | ✅ | ✅ | Compatible |
|
|
71
|
+
| `__contains__(key)` | ✅ | ✅ | Compatible |
|
|
72
|
+
| `__getitem__(key)` | ✅ | ✅ | Compatible |
|
|
73
|
+
| `__setitem__(key, value)` | ✅ | ✅ | Compatible |
|
|
74
|
+
| `__delitem__(key)` | ✅ | ✅ | Compatible |
|
|
75
|
+
| `__iter__()` | ✅ | ✅ | Compatible |
|
|
76
|
+
| `__reversed__()` | ✅ | ✅ | Compatible |
|
|
77
|
+
| `__len__()` | ✅ | ✅ | Compatible |
|
|
78
|
+
| `__getstate__()` / `__setstate__()` | ✅ | ✅ | Pickle serialization support |
|
|
79
|
+
| `get(key, default, read, expire_time, tag, ...)` | ✅ | ✅ | Full support including expire_time and tag return |
|
|
80
|
+
| `set(key, value, expire, read, tag, ...)` | ✅ | ✅ | Full support |
|
|
81
|
+
| `delete(key, retry)` | ✅ | ✅ | Compatible |
|
|
82
|
+
| `add(key, value, ...)` | ✅ | ✅ | Compatible |
|
|
83
|
+
| `incr(key, delta, ...)` | ✅ | ✅ | Compatible |
|
|
84
|
+
| `decr(key, delta, ...)` | ✅ | ✅ | Compatible |
|
|
85
|
+
| `pop(key, default, ...)` | ✅ | ✅ | Compatible |
|
|
86
|
+
| `touch(key, expire, ...)` | ✅ | ✅ | Compatible |
|
|
87
|
+
| `expire(retry)` | ✅ | ✅ | Compatible |
|
|
88
|
+
| `evict(tag, retry)` | ✅ | ✅ | Full tag-based eviction |
|
|
89
|
+
| `clear(retry)` | ✅ | ✅ | Compatible |
|
|
90
|
+
| `stats(enable, reset)` | ✅ | ✅ | Compatible |
|
|
91
|
+
| `volume()` | ✅ | ✅ | Compatible |
|
|
92
|
+
| `close()` | ✅ | ✅ | Compatible |
|
|
93
|
+
| `__enter__()` / `__exit__()` | ✅ | ✅ | Context manager support |
|
|
94
|
+
| `memoize(name, typed, expire, tag, ignore)` | ✅ | ✅ | Compatible |
|
|
95
|
+
| `transact(retry)` | ✅ | ✅ | Compatible |
|
|
96
|
+
| `iterkeys(reverse)` | ✅ | ✅ | Compatible |
|
|
97
|
+
| `peekitem(last, ...)` | ✅ | ✅ | Compatible with expire_time/tag support |
|
|
98
|
+
| `check(fix, retry)` | ✅ | ✅ | Compatible |
|
|
99
|
+
| `cull(retry)` | ✅ | ✅ | Compatible |
|
|
100
|
+
| `reset(key, value)` | ✅ | ✅ | Compatible |
|
|
101
|
+
| `read(key, retry)` | ✅ | ✅ | Returns BytesIO handle |
|
|
102
|
+
| `push(value, prefix, side, ...)` | ✅ | ✅ | Queue operations |
|
|
103
|
+
| `pull(prefix, default, side, ...)` | ✅ | ✅ | Queue operations |
|
|
104
|
+
| `peek(prefix, default, side, ...)` | ✅ | ✅ | Queue operations |
|
|
105
|
+
| `create_tag_index()` | ✅ | ✅ | No-op (tags inline) |
|
|
106
|
+
| `drop_tag_index()` | ✅ | ✅ | No-op (tags inline) |
|
|
107
|
+
| `cache(name, ...)` | ✅ | ✅ | Sub-cache factory |
|
|
108
|
+
| `deque(name, maxlen)` | ✅ | ✅ | Deque factory |
|
|
109
|
+
| `index(name)` | ✅ | ✅ | Index factory |
|
|
110
|
+
| `keys()` | ✅ | ✅ | Compatible |
|
|
111
|
+
| `values()` | ✅ | ✅ | Compatible |
|
|
112
|
+
| `items()` | ✅ | ✅ | Compatible |
|
|
113
|
+
| `exists(key)` | ✅ | ✅ | Compatible |
|
|
114
|
+
| `vacuum()` | ✅ | ✅ | Compatible |
|
|
115
|
+
| `directory` (property) | ✅ | ✅ | Compatible |
|
|
116
|
+
| `timeout` (property) | ✅ | ✅ | Compatible |
|
|
117
|
+
| `disk` (property) | ✅ | ✅ | Returns compatible proxy |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Deque Class API Comparison
|
|
122
|
+
|
|
123
|
+
### ✅ Fully Compatible Methods
|
|
124
|
+
|
|
125
|
+
| Method | diskcache | diskcache_rs | Notes |
|
|
126
|
+
|--------|-----------|--------------|-------|
|
|
127
|
+
| `__init__(iterable, directory, maxlen)` | ✅ | ✅ | Compatible |
|
|
128
|
+
| `append(value)` | ✅ | ✅ | Compatible |
|
|
129
|
+
| `appendleft(value)` | ✅ | ✅ | Compatible |
|
|
130
|
+
| `pop()` | ✅ | ✅ | Compatible |
|
|
131
|
+
| `popleft()` | ✅ | ✅ | Compatible |
|
|
132
|
+
| `peek()` | ✅ | ✅ | Compatible |
|
|
133
|
+
| `peekleft()` | ✅ | ✅ | Compatible |
|
|
134
|
+
| `clear()` | ✅ | ✅ | Compatible |
|
|
135
|
+
| `extend(iterable)` | ✅ | ✅ | Compatible |
|
|
136
|
+
| `extendleft(iterable)` | ✅ | ✅ | Compatible |
|
|
137
|
+
| `copy()` | ✅ | ✅ | Compatible |
|
|
138
|
+
| `count(value)` | ✅ | ✅ | Compatible |
|
|
139
|
+
| `remove(value)` | ✅ | ✅ | Compatible |
|
|
140
|
+
| `reverse()` | ✅ | ✅ | Compatible |
|
|
141
|
+
| `rotate(steps)` | ✅ | ✅ | Compatible |
|
|
142
|
+
| `__len__()` | ✅ | ✅ | Compatible |
|
|
143
|
+
| `__iter__()` | ✅ | ✅ | Compatible |
|
|
144
|
+
| `__reversed__()` | ✅ | ✅ | Compatible |
|
|
145
|
+
| `__bool__()` | ✅ | ✅ | Compatible |
|
|
146
|
+
| `__contains__(value)` | ✅ | ✅ | Compatible |
|
|
147
|
+
| `__getitem__(index)` | ✅ | ✅ | Compatible |
|
|
148
|
+
| `__setitem__(index, value)` | ✅ | ✅ | Compatible |
|
|
149
|
+
| `__delitem__(index)` | ✅ | ✅ | Compatible |
|
|
150
|
+
| `__eq__` / `__ne__` / `__lt__` / `__gt__` / `__le__` / `__ge__` | ✅ | ✅ | All comparison operators |
|
|
151
|
+
| `__iadd__(other)` | ✅ | ✅ | In-place addition |
|
|
152
|
+
| `__getstate__()` / `__setstate__()` | ✅ | ✅ | Pickle support |
|
|
153
|
+
| `transact()` | ✅ | ✅ | Transaction support |
|
|
154
|
+
| `maxlen` (property) | ✅ | ✅ | Compatible |
|
|
155
|
+
| `directory` (property) | ✅ | ✅ | Compatible |
|
|
156
|
+
| `close()` | ✅ | ✅ | Compatible |
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Index Class API Comparison
|
|
161
|
+
|
|
162
|
+
### ✅ Fully Compatible Methods
|
|
163
|
+
|
|
164
|
+
| Method | diskcache | diskcache_rs | Notes |
|
|
165
|
+
|--------|-----------|--------------|-------|
|
|
166
|
+
| `__init__(*args, directory, **kwargs)` | ✅ | ✅ | Compatible |
|
|
167
|
+
| `__getitem__(key)` | ✅ | ✅ | Compatible |
|
|
168
|
+
| `__setitem__(key, value)` | ✅ | ✅ | Compatible |
|
|
169
|
+
| `__delitem__(key)` | ✅ | ✅ | Compatible |
|
|
170
|
+
| `__contains__(key)` | ✅ | ✅ | Compatible |
|
|
171
|
+
| `__iter__()` | ✅ | ✅ | Compatible |
|
|
172
|
+
| `__reversed__()` | ✅ | ✅ | Compatible |
|
|
173
|
+
| `__len__()` | ✅ | ✅ | Compatible |
|
|
174
|
+
| `__bool__()` | ✅ | ✅ | Compatible |
|
|
175
|
+
| `__eq__` / `__ne__` | ✅ | ✅ | Comparison operators |
|
|
176
|
+
| `__getstate__()` / `__setstate__()` | ✅ | ✅ | Pickle support |
|
|
177
|
+
| `get(key, default)` | ✅ | ✅ | Compatible |
|
|
178
|
+
| `pop(key, default)` | ✅ | ✅ | Compatible |
|
|
179
|
+
| `popitem(last)` | ✅ | ✅ | Compatible |
|
|
180
|
+
| `setdefault(key, default)` | ✅ | ✅ | Compatible |
|
|
181
|
+
| `keys()` | ✅ | ✅ | Compatible |
|
|
182
|
+
| `values()` | ✅ | ✅ | Compatible |
|
|
183
|
+
| `items()` | ✅ | ✅ | Compatible |
|
|
184
|
+
| `update(*args, **kwargs)` | ✅ | ✅ | Compatible |
|
|
185
|
+
| `clear()` | ✅ | ✅ | Compatible |
|
|
186
|
+
| `peekitem(last)` | ✅ | ✅ | Compatible |
|
|
187
|
+
| `cache` (property) | ✅ | ✅ | Returns underlying Cache |
|
|
188
|
+
| `directory` (property) | ✅ | ✅ | Compatible |
|
|
189
|
+
| `close()` | ✅ | ✅ | Compatible |
|
|
190
|
+
| `transact()` | ✅ | ✅ | Transaction support |
|
|
191
|
+
| `memoize(name, typed, ignore)` | ✅ | ✅ | Memoization decorator |
|
|
192
|
+
| `push(value, prefix, side)` | ✅ | ✅ | Queue operations |
|
|
193
|
+
| `pull(prefix, default, side)` | ✅ | ✅ | Queue operations |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Migration Impact Assessment
|
|
198
|
+
|
|
199
|
+
### ✅ **Low-Risk Migration** (Simple Use Cases)
|
|
200
|
+
|
|
201
|
+
If your code only uses:
|
|
202
|
+
- Basic get/set/delete operations
|
|
203
|
+
- Dictionary-style access (`cache[key]`, `key in cache`)
|
|
204
|
+
- Iteration and length
|
|
205
|
+
- Context managers (`with cache:`)
|
|
206
|
+
- Basic statistics
|
|
207
|
+
|
|
208
|
+
**Migration**: Simply change `import diskcache` to `import diskcache_rs` ✅
|
|
209
|
+
|
|
210
|
+
### ✅ **Medium-Risk Migration** (Advanced Features) - FULLY SUPPORTED
|
|
211
|
+
|
|
212
|
+
If your code uses:
|
|
213
|
+
- `incr()`/`decr()` operations
|
|
214
|
+
- `add()` for atomic operations
|
|
215
|
+
- `touch()` to update expiration
|
|
216
|
+
- `pop()` to atomically remove and return
|
|
217
|
+
- `memoize()` decorator
|
|
218
|
+
- `transact()` context manager
|
|
219
|
+
- Queue operations (`push`/`pull`/`peek`)
|
|
220
|
+
- Sub-caches (`cache()`/`deque()`/`index()`)
|
|
221
|
+
- `Deque` and `Index` classes
|
|
222
|
+
- Tag-based operations (`set(tag=...)`, `evict(tag)`)
|
|
223
|
+
- `get(expire_time=True, tag=True)` metadata return
|
|
224
|
+
- `read=True` parameter for file-like objects
|
|
225
|
+
- Pickle serialization (`__getstate__`/`__setstate__`)
|
|
226
|
+
|
|
227
|
+
**Migration**: Simply change `import diskcache` to `import diskcache_rs` ✅
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Compatibility Score
|
|
232
|
+
|
|
233
|
+
| Category | Score | Details |
|
|
234
|
+
|----------|-------|---------|
|
|
235
|
+
| **Core Operations** | 100% | ✅ get, set, delete, clear, contains, iteration |
|
|
236
|
+
| **Dictionary Interface** | 100% | ✅ `[]`, `in`, `len()`, `iter()`, `reversed()` |
|
|
237
|
+
| **Atomic Operations** | 100% | ✅ incr/decr/add/pop/touch |
|
|
238
|
+
| **Memoization** | 100% | ✅ `memoize()` decorator |
|
|
239
|
+
| **Transactions** | 100% | ✅ `transact()` context manager |
|
|
240
|
+
| **Queue Operations** | 100% | ✅ push/pull/peek |
|
|
241
|
+
| **Maintenance** | 100% | ✅ check/cull/expire/vacuum/reset |
|
|
242
|
+
| **Sub-caches** | 100% | ✅ cache()/deque()/index() |
|
|
243
|
+
| **Metadata** | 100% | ✅ directory/timeout/disk/stats/volume |
|
|
244
|
+
| **Tag Operations** | 100% | ✅ Tags tracked and fully queryable |
|
|
245
|
+
| **Expire Time Return** | 100% | ✅ get/pop/peek/peekitem with expire_time=True |
|
|
246
|
+
| **Read Parameter** | 100% | ✅ set(read=True) and get(read=True) |
|
|
247
|
+
| **Pickle Support** | 100% | ✅ __getstate__/__setstate__ for all classes |
|
|
248
|
+
| **Deque** | 100% | ✅ Full collections.deque-like interface |
|
|
249
|
+
| **Index** | 100% | ✅ Full MutableMapping interface |
|
|
250
|
+
| **Overall** | **~100%** | Complete API compatibility |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Example Migration Scenarios
|
|
255
|
+
|
|
256
|
+
### ✅ Scenario 1: Simple Cache (Works Out of Box)
|
|
257
|
+
|
|
258
|
+
```python
|
|
259
|
+
# Before (diskcache)
|
|
260
|
+
from diskcache import Cache
|
|
261
|
+
|
|
262
|
+
cache = Cache('/tmp/mycache')
|
|
263
|
+
cache['key'] = 'value'
|
|
264
|
+
print(cache['key'])
|
|
265
|
+
del cache['key']
|
|
266
|
+
|
|
267
|
+
# After (diskcache_rs) - NO CHANGES NEEDED
|
|
268
|
+
from diskcache_rs import Cache
|
|
269
|
+
|
|
270
|
+
cache = Cache('/tmp/mycache')
|
|
271
|
+
cache['key'] = 'value'
|
|
272
|
+
print(cache['key'])
|
|
273
|
+
del cache['key']
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### ✅ Scenario 2: Tag-based Operations (Now Fully Working!)
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
# Before (diskcache)
|
|
280
|
+
from diskcache import Cache
|
|
281
|
+
|
|
282
|
+
cache = Cache('/tmp/mycache')
|
|
283
|
+
cache.set('user:1', {'name': 'Alice'}, tag='users')
|
|
284
|
+
cache.set('user:2', {'name': 'Bob'}, tag='users')
|
|
285
|
+
cache.set('session:1', 'abc123', tag='sessions')
|
|
286
|
+
|
|
287
|
+
# Get with tag
|
|
288
|
+
value, tag = cache.get('user:1', tag=True)
|
|
289
|
+
|
|
290
|
+
# Evict all users
|
|
291
|
+
cache.evict('users')
|
|
292
|
+
|
|
293
|
+
# After (diskcache_rs) - NO CHANGES NEEDED
|
|
294
|
+
from diskcache_rs import Cache
|
|
295
|
+
|
|
296
|
+
cache = Cache('/tmp/mycache')
|
|
297
|
+
cache.set('user:1', {'name': 'Alice'}, tag='users')
|
|
298
|
+
cache.set('user:2', {'name': 'Bob'}, tag='users')
|
|
299
|
+
cache.set('session:1', 'abc123', tag='sessions')
|
|
300
|
+
|
|
301
|
+
value, tag = cache.get('user:1', tag=True)
|
|
302
|
+
cache.evict('users')
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### ✅ Scenario 3: Memoization (Works!)
|
|
306
|
+
|
|
307
|
+
```python
|
|
308
|
+
# Before (diskcache)
|
|
309
|
+
from diskcache import Cache
|
|
310
|
+
|
|
311
|
+
cache = Cache('/tmp/mycache')
|
|
312
|
+
|
|
313
|
+
@cache.memoize(expire=60)
|
|
314
|
+
def expensive_function(x):
|
|
315
|
+
return x * x
|
|
316
|
+
|
|
317
|
+
expensive_function(5) # 25
|
|
318
|
+
|
|
319
|
+
# After (diskcache_rs) - NO CHANGES NEEDED
|
|
320
|
+
from diskcache_rs import Cache
|
|
321
|
+
|
|
322
|
+
cache = Cache('/tmp/mycache')
|
|
323
|
+
|
|
324
|
+
@cache.memoize(expire=60)
|
|
325
|
+
def expensive_function(x):
|
|
326
|
+
return x * x
|
|
327
|
+
|
|
328
|
+
expensive_function(5) # 25
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### ✅ Scenario 4: Transactions (Works!)
|
|
332
|
+
|
|
333
|
+
```python
|
|
334
|
+
# Before (diskcache)
|
|
335
|
+
from diskcache import Cache
|
|
336
|
+
|
|
337
|
+
cache = Cache('/tmp/mycache')
|
|
338
|
+
with cache.transact():
|
|
339
|
+
cache['total'] = cache.get('total', 0) + 123.4
|
|
340
|
+
cache['count'] = cache.get('count', 0) + 1
|
|
341
|
+
|
|
342
|
+
# After (diskcache_rs) - NO CHANGES NEEDED
|
|
343
|
+
from diskcache_rs import Cache
|
|
344
|
+
|
|
345
|
+
cache = Cache('/tmp/mycache')
|
|
346
|
+
with cache.transact():
|
|
347
|
+
cache['total'] = cache.get('total', 0) + 123.4
|
|
348
|
+
cache['count'] = cache.get('count', 0) + 1
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### ✅ Scenario 5: FanoutCache with Sub-caches (Works!)
|
|
352
|
+
|
|
353
|
+
```python
|
|
354
|
+
# Before (diskcache)
|
|
355
|
+
from diskcache import FanoutCache
|
|
356
|
+
|
|
357
|
+
fc = FanoutCache('/tmp/mycache')
|
|
358
|
+
users = fc.cache('users')
|
|
359
|
+
tasks = fc.deque('tasks')
|
|
360
|
+
meta = fc.index('metadata')
|
|
361
|
+
|
|
362
|
+
# After (diskcache_rs) - NO CHANGES NEEDED
|
|
363
|
+
from diskcache_rs import FanoutCache
|
|
364
|
+
|
|
365
|
+
fc = FanoutCache('/tmp/mycache')
|
|
366
|
+
users = fc.cache('users')
|
|
367
|
+
tasks = fc.deque('tasks')
|
|
368
|
+
meta = fc.index('metadata')
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### ✅ Scenario 6: Deque with Full Collections Interface (Works!)
|
|
372
|
+
|
|
373
|
+
```python
|
|
374
|
+
# Before (diskcache)
|
|
375
|
+
from diskcache import Deque
|
|
376
|
+
|
|
377
|
+
dq = Deque(directory='/tmp/mydeque')
|
|
378
|
+
dq.extend([1, 2, 3, 4, 5])
|
|
379
|
+
dq.rotate(2)
|
|
380
|
+
print(dq[0]) # 4
|
|
381
|
+
dq.reverse()
|
|
382
|
+
dq.remove(3)
|
|
383
|
+
print(dq.count(1))
|
|
384
|
+
|
|
385
|
+
# After (diskcache_rs) - NO CHANGES NEEDED
|
|
386
|
+
from diskcache_rs import Deque
|
|
387
|
+
|
|
388
|
+
dq = Deque(directory='/tmp/mydeque')
|
|
389
|
+
dq.extend([1, 2, 3, 4, 5])
|
|
390
|
+
dq.rotate(2)
|
|
391
|
+
print(dq[0]) # 4
|
|
392
|
+
dq.reverse()
|
|
393
|
+
dq.remove(3)
|
|
394
|
+
print(dq.count(1))
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### ✅ Scenario 7: Index with Full Mapping Interface (Works!)
|
|
398
|
+
|
|
399
|
+
```python
|
|
400
|
+
# Before (diskcache)
|
|
401
|
+
from diskcache import Index
|
|
402
|
+
|
|
403
|
+
idx = Index(directory='/tmp/myindex')
|
|
404
|
+
idx['a'] = 1
|
|
405
|
+
idx['b'] = 2
|
|
406
|
+
key, value = idx.popitem()
|
|
407
|
+
idx == {'a': 1}
|
|
408
|
+
|
|
409
|
+
# After (diskcache_rs) - NO CHANGES NEEDED
|
|
410
|
+
from diskcache_rs import Index
|
|
411
|
+
|
|
412
|
+
idx = Index(directory='/tmp/myindex')
|
|
413
|
+
idx['a'] = 1
|
|
414
|
+
idx['b'] = 2
|
|
415
|
+
key, value = idx.popitem()
|
|
416
|
+
idx == {'a': 1}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## Conclusion
|
|
422
|
+
|
|
423
|
+
### Can developers just change the namespace?
|
|
424
|
+
|
|
425
|
+
**Answer**: **Yes, for ~100% of use cases** ✅
|
|
426
|
+
|
|
427
|
+
- ✅ **Basic caching** (get/set/delete): Fully compatible
|
|
428
|
+
- ✅ **Dictionary interface**: Fully compatible
|
|
429
|
+
- ✅ **Atomic operations** (incr/decr/add/pop/touch): Fully compatible
|
|
430
|
+
- ✅ **Memoization** (`memoize()` decorator): Fully compatible
|
|
431
|
+
- ✅ **Transactions** (`transact()` context manager): Fully compatible
|
|
432
|
+
- ✅ **Queue operations** (push/pull/peek): Fully compatible
|
|
433
|
+
- ✅ **Sub-caches** (cache/deque/index): Fully compatible
|
|
434
|
+
- ✅ **Deque and Index** classes: Fully compatible with all methods
|
|
435
|
+
- ✅ **Maintenance** (check/cull/expire/vacuum/reset): Fully compatible
|
|
436
|
+
- ✅ **Metadata** (directory/timeout/disk/stats/volume): Fully compatible
|
|
437
|
+
- ✅ **Tag operations** (set with tag, get with tag, evict by tag): Fully compatible
|
|
438
|
+
- ✅ **Expire time return** (get/pop/peek with expire_time): Fully compatible
|
|
439
|
+
- ✅ **Read parameter** (set/get with read=True): Fully compatible
|
|
440
|
+
- ✅ **Pickle serialization** (__getstate__/__setstate__): Fully compatible
|
|
441
|
+
|
|
442
|
+
**Migration is straightforward for all use cases - just change the import!** 🎉
|
|
@@ -4,7 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
- sync Cargo.toml version with .cz.toml and update CHANGELOG for v0.4.0
|
|
6
6
|
|
|
7
|
-
## [0.4.
|
|
7
|
+
## [0.4.6](https://github.com/loonghao/diskcache_rs/compare/diskcache_rs-v0.4.5...diskcache_rs-v0.4.6) (2026-03-24)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add expire() method to Cache and FanoutCache (fixes [#78](https://github.com/loonghao/diskcache_rs/issues/78)) ([d044a63](https://github.com/loonghao/diskcache_rs/commit/d044a63e0bd9383880703d1f8c5ddc8b70118163))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* use deterministic hashing for FanoutCache shard assignment ([bfe1aeb](https://github.com/loonghao/diskcache_rs/commit/bfe1aebaed3ae3c338f5ab4496fd442c661ec8f7))
|
|
18
|
+
|
|
19
|
+
## [0.4.5](https://github.com/loonghao/diskcache_rs/compare/diskcache_rs-v0.4.4...diskcache_rs-v0.4.5) (2026-01-04)
|
|
8
20
|
|
|
9
21
|
|
|
10
22
|
### Bug Fixes
|