diskcache-rs 0.4.6__tar.gz → 0.4.8__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 → diskcache_rs-0.4.8}/.github/actions/build-and-test/action.yml +1 -1
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.github/workflows/benchmark.yml +1 -1
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.github/workflows/build-abi3.yml +4 -4
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.github/workflows/build.yml +6 -6
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.github/workflows/release.yml +3 -3
- diskcache_rs-0.4.8/.release-please-manifest.json +3 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/API_COMPATIBILITY.md +86 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/CHANGELOG.md +21 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/Cargo.lock +24 -69
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/Cargo.toml +3 -3
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/PKG-INFO +1 -1
- diskcache_rs-0.4.8/benchmarks/batch_write_comparison.py +90 -0
- diskcache_rs-0.4.8/python/diskcache_rs/__init__.py +94 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/python/diskcache_rs/__init__.pyi +222 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/python/diskcache_rs/_diskcache_rs.pyi +7 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/python/diskcache_rs/cache.py +43 -0
- diskcache_rs-0.4.8/python/diskcache_rs/constants.py +125 -0
- diskcache_rs-0.4.8/python/diskcache_rs/disk.py +252 -0
- diskcache_rs-0.4.8/python/diskcache_rs/recipes.py +535 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/cache.rs +44 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/storage/optimized_backend.rs +209 -55
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/storage.rs +2 -0
- diskcache_rs-0.4.8/tests/test_batch_operations.py +83 -0
- diskcache_rs-0.4.8/tests/test_recipes_and_constants.py +658 -0
- diskcache_rs-0.4.6/.release-please-manifest.json +0 -3
- diskcache_rs-0.4.6/python/diskcache_rs/__init__.py +0 -39
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.github/actions/setup-diskcache-rs/action.yml +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.github/pull_request_template.md +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.github/workflows/ci.yml +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.gitignore +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/.pre-commit-config.yaml +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/Dockerfile.test +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/LICENSE +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/README.md +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/comprehensive_performance_test.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/detailed_profiling.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/final_performance_comparison.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/high_performance_test.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/memory_usage_test.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/micro_benchmark.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/optimization_validation_test.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/performance_comparison.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/precise_benchmark.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/benchmarks/set_performance_analysis.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/docker-compose.test.yml +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/examples/basic_usage.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/examples/special_chars_keys_example.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/justfile +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/pyproject.toml +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/python/diskcache_rs/core.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/python/diskcache_rs/fast_cache.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/python/diskcache_rs/pickle_cache.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/python/diskcache_rs/rust_pickle.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/release-please-config.json +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/renovate.json +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/scripts/generate_stubs.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/scripts/sync_version.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/scripts/test-docker-network.sh +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/error.rs +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/eviction.rs +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/lib.rs +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/memory_cache.rs +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/migration.rs +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/pickle_cache.rs +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/serialization.rs +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/storage/tests.rs +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/src/utils.rs +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/__init__.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/benchmark_official.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/conftest.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_api_compatibility.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_basic_operations.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_ci_benchmark.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_compatibility.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_complete_api_gaps.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_cross_platform_network.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_diskcache_rs_persistence_suite.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_docker_network.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_fast_cache.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_full_api_compatibility.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_issue_17_configurable_threshold.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_issue_73_deterministic_hashing.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_issue_78_expire_method.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_network_filesystem.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_performance.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_pickle_cache.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_rust_pickle_performance.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_special_chars_keys.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/tests/test_version_and_disk_threshold.py +0 -0
- {diskcache_rs-0.4.6 → diskcache_rs-0.4.8}/uv.lock +0 -0
|
@@ -37,7 +37,7 @@ jobs:
|
|
|
37
37
|
pip install diskcache_rs --find-links dist --force-reinstall
|
|
38
38
|
python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
|
|
39
39
|
- name: Upload wheels
|
|
40
|
-
uses: actions/upload-artifact@
|
|
40
|
+
uses: actions/upload-artifact@v7
|
|
41
41
|
with:
|
|
42
42
|
name: wheels-linux-abi3-${{ matrix.target }}
|
|
43
43
|
path: dist
|
|
@@ -66,7 +66,7 @@ jobs:
|
|
|
66
66
|
pip install diskcache_rs --find-links dist --force-reinstall
|
|
67
67
|
python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
|
|
68
68
|
- name: Upload wheels
|
|
69
|
-
uses: actions/upload-artifact@
|
|
69
|
+
uses: actions/upload-artifact@v7
|
|
70
70
|
with:
|
|
71
71
|
name: wheels-windows-abi3-${{ matrix.target }}
|
|
72
72
|
path: dist
|
|
@@ -95,7 +95,7 @@ jobs:
|
|
|
95
95
|
pip install diskcache_rs --find-links dist --force-reinstall
|
|
96
96
|
python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
|
|
97
97
|
- name: Upload wheels
|
|
98
|
-
uses: actions/upload-artifact@
|
|
98
|
+
uses: actions/upload-artifact@v7
|
|
99
99
|
with:
|
|
100
100
|
name: wheels-macos-abi3-${{ matrix.target }}
|
|
101
101
|
path: dist
|
|
@@ -111,7 +111,7 @@ jobs:
|
|
|
111
111
|
command: sdist
|
|
112
112
|
args: --out dist
|
|
113
113
|
- name: Upload sdist
|
|
114
|
-
uses: actions/upload-artifact@
|
|
114
|
+
uses: actions/upload-artifact@v7
|
|
115
115
|
with:
|
|
116
116
|
name: wheels-sdist-abi3
|
|
117
117
|
path: dist
|
|
@@ -40,7 +40,7 @@ jobs:
|
|
|
40
40
|
pip install diskcache_rs --find-links dist --force-reinstall
|
|
41
41
|
python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
|
|
42
42
|
- name: Upload wheels
|
|
43
|
-
uses: actions/upload-artifact@
|
|
43
|
+
uses: actions/upload-artifact@v7
|
|
44
44
|
with:
|
|
45
45
|
name: wheels-linux-${{ matrix.target }}
|
|
46
46
|
path: dist
|
|
@@ -79,7 +79,7 @@ jobs:
|
|
|
79
79
|
uv pip install diskcache_rs --find-links dist/ --force-reinstall --system
|
|
80
80
|
python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
|
|
81
81
|
- name: Upload wheels
|
|
82
|
-
uses: actions/upload-artifact@
|
|
82
|
+
uses: actions/upload-artifact@v7
|
|
83
83
|
with:
|
|
84
84
|
name: wheels-linux-cross-${{ matrix.target }}
|
|
85
85
|
path: dist
|
|
@@ -125,7 +125,7 @@ jobs:
|
|
|
125
125
|
fi
|
|
126
126
|
python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
|
|
127
127
|
- name: Upload wheels
|
|
128
|
-
uses: actions/upload-artifact@
|
|
128
|
+
uses: actions/upload-artifact@v7
|
|
129
129
|
with:
|
|
130
130
|
name: wheels-musllinux-${{ matrix.target }}
|
|
131
131
|
path: dist
|
|
@@ -173,7 +173,7 @@ jobs:
|
|
|
173
173
|
fi
|
|
174
174
|
python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
|
|
175
175
|
- name: Upload wheels
|
|
176
|
-
uses: actions/upload-artifact@
|
|
176
|
+
uses: actions/upload-artifact@v7
|
|
177
177
|
with:
|
|
178
178
|
name: wheels-musllinux-cross-${{ matrix.platform.target }}
|
|
179
179
|
path: dist
|
|
@@ -202,7 +202,7 @@ jobs:
|
|
|
202
202
|
pip install diskcache_rs --find-links dist --force-reinstall
|
|
203
203
|
python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
|
|
204
204
|
- name: Upload wheels
|
|
205
|
-
uses: actions/upload-artifact@
|
|
205
|
+
uses: actions/upload-artifact@v7
|
|
206
206
|
with:
|
|
207
207
|
name: wheels-windows-${{ matrix.target }}
|
|
208
208
|
path: dist
|
|
@@ -238,7 +238,7 @@ jobs:
|
|
|
238
238
|
pip install diskcache_rs --find-links dist --force-reinstall
|
|
239
239
|
python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
|
|
240
240
|
- name: Upload wheels
|
|
241
|
-
uses: actions/upload-artifact@
|
|
241
|
+
uses: actions/upload-artifact@v7
|
|
242
242
|
with:
|
|
243
243
|
name: wheels-macos
|
|
244
244
|
path: dist
|
|
@@ -80,7 +80,7 @@ jobs:
|
|
|
80
80
|
|
|
81
81
|
steps:
|
|
82
82
|
- name: Download all artifacts
|
|
83
|
-
uses: actions/download-artifact@
|
|
83
|
+
uses: actions/download-artifact@v8
|
|
84
84
|
with:
|
|
85
85
|
path: dist
|
|
86
86
|
merge-multiple: true
|
|
@@ -91,7 +91,7 @@ jobs:
|
|
|
91
91
|
echo "Total files: $(ls -1 dist/ | wc -l)"
|
|
92
92
|
|
|
93
93
|
- name: Generate artifact attestation
|
|
94
|
-
uses: actions/attest-build-provenance@
|
|
94
|
+
uses: actions/attest-build-provenance@v4
|
|
95
95
|
with:
|
|
96
96
|
subject-path: 'dist/*'
|
|
97
97
|
|
|
@@ -143,7 +143,7 @@ jobs:
|
|
|
143
143
|
{{__unknown__}}
|
|
144
144
|
|
|
145
145
|
- name: Download all artifacts
|
|
146
|
-
uses: actions/download-artifact@
|
|
146
|
+
uses: actions/download-artifact@v8
|
|
147
147
|
with:
|
|
148
148
|
path: release-artifacts
|
|
149
149
|
merge-multiple: true
|
|
@@ -418,6 +418,87 @@ idx == {'a': 1}
|
|
|
418
418
|
|
|
419
419
|
---
|
|
420
420
|
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Recipes API Comparison
|
|
424
|
+
|
|
425
|
+
### ✅ Fully Compatible Synchronization Primitives
|
|
426
|
+
|
|
427
|
+
| Class/Function | diskcache | diskcache_rs | Notes |
|
|
428
|
+
|----------------|-----------|--------------|-------|
|
|
429
|
+
| `Lock(cache, key, expire, tag)` | ✅ | ✅ | Cross-process spin lock |
|
|
430
|
+
| `Lock.acquire()` | ✅ | ✅ | Spin-lock algorithm |
|
|
431
|
+
| `Lock.release()` | ✅ | ✅ | Delete-key based |
|
|
432
|
+
| `Lock.locked()` | ✅ | ✅ | Check if acquired |
|
|
433
|
+
| `Lock` context manager | ✅ | ✅ | `with lock:` |
|
|
434
|
+
| `RLock(cache, key, expire, tag)` | ✅ | ✅ | Re-entrant lock |
|
|
435
|
+
| `RLock.acquire()` | ✅ | ✅ | PID+TID based ownership |
|
|
436
|
+
| `RLock.release()` | ✅ | ✅ | Decrements count |
|
|
437
|
+
| `RLock` context manager | ✅ | ✅ | `with rlock:` |
|
|
438
|
+
| `BoundedSemaphore(cache, key, value, ...)` | ✅ | ✅ | Bounded semaphore |
|
|
439
|
+
| `BoundedSemaphore.acquire()` | ✅ | ✅ | Spin-lock decrement |
|
|
440
|
+
| `BoundedSemaphore.release()` | ✅ | ✅ | Increment with assertion |
|
|
441
|
+
| `BoundedSemaphore` context manager | ✅ | ✅ | `with sem:` |
|
|
442
|
+
|
|
443
|
+
### ✅ Fully Compatible Recipes and Decorators
|
|
444
|
+
|
|
445
|
+
| Class/Function | diskcache | diskcache_rs | Notes |
|
|
446
|
+
|----------------|-----------|--------------|-------|
|
|
447
|
+
| `Averager(cache, key, expire, tag)` | ✅ | ✅ | Running average |
|
|
448
|
+
| `Averager.add(value)` | ✅ | ✅ | Add value to average |
|
|
449
|
+
| `Averager.get()` | ✅ | ✅ | Get current average |
|
|
450
|
+
| `Averager.pop()` | ✅ | ✅ | Get average and delete |
|
|
451
|
+
| `throttle(cache, count, seconds, ...)` | ✅ | ✅ | Rate limiting decorator |
|
|
452
|
+
| `barrier(cache, lock_factory, ...)` | ✅ | ✅ | Barrier decorator |
|
|
453
|
+
| `memoize_stampede(cache, expire, ...)` | ✅ | ✅ | Stampede-protected memoize |
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Constants and Exceptions API Comparison
|
|
458
|
+
|
|
459
|
+
### ✅ Fully Compatible Constants
|
|
460
|
+
|
|
461
|
+
| Constant | diskcache | diskcache_rs | Notes |
|
|
462
|
+
|----------|-----------|--------------|-------|
|
|
463
|
+
| `ENOVAL` | ✅ | ✅ | Cache miss sentinel |
|
|
464
|
+
| `UNKNOWN` | ✅ | ✅ | Unknown value sentinel |
|
|
465
|
+
| `DEFAULT_SETTINGS` | ✅ | ✅ | Default cache settings dict |
|
|
466
|
+
| `EVICTION_POLICY` | ✅ | ✅ | Eviction policy definitions |
|
|
467
|
+
|
|
468
|
+
### ✅ Fully Compatible Exceptions and Warnings
|
|
469
|
+
|
|
470
|
+
| Class | diskcache | diskcache_rs | Notes |
|
|
471
|
+
|-------|-----------|--------------|-------|
|
|
472
|
+
| `Timeout` | ✅ | ✅ | Database timeout exception |
|
|
473
|
+
| `EmptyDirWarning` | ✅ | ✅ | Empty directory warning |
|
|
474
|
+
| `UnknownFileWarning` | ✅ | ✅ | Unknown file warning |
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
## Disk Serialization API Comparison
|
|
479
|
+
|
|
480
|
+
### ✅ Fully Compatible Disk Classes
|
|
481
|
+
|
|
482
|
+
| Class | diskcache | diskcache_rs | Notes |
|
|
483
|
+
|-------|-----------|--------------|-------|
|
|
484
|
+
| `Disk(directory, min_file_size, ...)` | ✅ | ✅ | Pickle-based serialization |
|
|
485
|
+
| `Disk.store(value, read, key)` | ✅ | ✅ | Serialize value |
|
|
486
|
+
| `Disk.fetch(mode, filename, value, read)` | ✅ | ✅ | Deserialize value |
|
|
487
|
+
| `Disk.put(key)` | ✅ | ✅ | Serialize key |
|
|
488
|
+
| `Disk.get(key, raw)` | ✅ | ✅ | Deserialize key |
|
|
489
|
+
| `Disk.hash(key)` | ✅ | ✅ | Hash key |
|
|
490
|
+
| `Disk.filename(key, value)` | ✅ | ✅ | Generate filename |
|
|
491
|
+
| `Disk.remove(filename)` | ✅ | ✅ | Remove file |
|
|
492
|
+
| `JSONDisk(directory, compress_level)` | ✅ | ✅ | JSON+zlib serialization |
|
|
493
|
+
|
|
494
|
+
### ⚠️ Not Applicable
|
|
495
|
+
|
|
496
|
+
| Feature | Notes |
|
|
497
|
+
|---------|-------|
|
|
498
|
+
| `DjangoCache` | Django integration - only available when Django is installed |
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
421
502
|
## Conclusion
|
|
422
503
|
|
|
423
504
|
### Can developers just change the namespace?
|
|
@@ -438,5 +519,10 @@ idx == {'a': 1}
|
|
|
438
519
|
- ✅ **Expire time return** (get/pop/peek with expire_time): Fully compatible
|
|
439
520
|
- ✅ **Read parameter** (set/get with read=True): Fully compatible
|
|
440
521
|
- ✅ **Pickle serialization** (__getstate__/__setstate__): Fully compatible
|
|
522
|
+
- ✅ **Synchronization** (Lock/RLock/BoundedSemaphore): Fully compatible
|
|
523
|
+
- ✅ **Recipes** (Averager/throttle/barrier/memoize_stampede): Fully compatible
|
|
524
|
+
- ✅ **Constants** (ENOVAL/UNKNOWN/DEFAULT_SETTINGS/EVICTION_POLICY): Fully compatible
|
|
525
|
+
- ✅ **Exceptions** (Timeout/EmptyDirWarning/UnknownFileWarning): Fully compatible
|
|
526
|
+
- ✅ **Disk classes** (Disk/JSONDisk): Fully compatible
|
|
441
527
|
|
|
442
528
|
**Migration is straightforward for all use cases - just change the import!** 🎉
|
|
@@ -4,6 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
- sync Cargo.toml version with .cz.toml and update CHANGELOG for v0.4.0
|
|
6
6
|
|
|
7
|
+
## [0.4.8](https://github.com/loonghao/diskcache_rs/compare/diskcache_rs-v0.4.7...diskcache_rs-v0.4.8) (2026-03-24)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add batched cache writes and overwrite cleanup ([82f028e](https://github.com/loonghao/diskcache_rs/commit/82f028e884dbdeed158f6c0db81053fb0afe03de))
|
|
13
|
+
* add recipes, constants, exceptions, Disk/JSONDisk for full python-diskcache API parity ([799bc4d](https://github.com/loonghao/diskcache_rs/commit/799bc4dd3760b80570f3afd3922475ebc9f3413f))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **deps:** update rust crate pyo3 to 0.28 ([deb83c9](https://github.com/loonghao/diskcache_rs/commit/deb83c93d535aa564e423478f383bec959109775))
|
|
19
|
+
* satisfy code quality checks ([a38139e](https://github.com/loonghao/diskcache_rs/commit/a38139e12317069a6cb56bd7cb6c49948630c8d8))
|
|
20
|
+
|
|
21
|
+
## [0.4.7](https://github.com/loonghao/diskcache_rs/compare/diskcache_rs-v0.4.6...diskcache_rs-v0.4.7) (2026-03-24)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **deps:** update rust crate rusqlite to 0.39 ([be60cc4](https://github.com/loonghao/diskcache_rs/commit/be60cc4fec7f689a3996e4ba1835246f0879ea87))
|
|
27
|
+
|
|
7
28
|
## [0.4.6](https://github.com/loonghao/diskcache_rs/compare/diskcache_rs-v0.4.5...diskcache_rs-v0.4.6) (2026-03-24)
|
|
8
29
|
|
|
9
30
|
|
|
@@ -246,7 +246,7 @@ dependencies = [
|
|
|
246
246
|
|
|
247
247
|
[[package]]
|
|
248
248
|
name = "diskcache_rs"
|
|
249
|
-
version = "0.4.
|
|
249
|
+
version = "0.4.8"
|
|
250
250
|
dependencies = [
|
|
251
251
|
"anyhow",
|
|
252
252
|
"bincode",
|
|
@@ -350,18 +350,6 @@ dependencies = [
|
|
|
350
350
|
"windows-sys",
|
|
351
351
|
]
|
|
352
352
|
|
|
353
|
-
[[package]]
|
|
354
|
-
name = "getrandom"
|
|
355
|
-
version = "0.3.4"
|
|
356
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
357
|
-
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
|
358
|
-
dependencies = [
|
|
359
|
-
"cfg-if",
|
|
360
|
-
"libc",
|
|
361
|
-
"r-efi 5.3.0",
|
|
362
|
-
"wasip2",
|
|
363
|
-
]
|
|
364
|
-
|
|
365
353
|
[[package]]
|
|
366
354
|
name = "getrandom"
|
|
367
355
|
version = "0.4.2"
|
|
@@ -370,7 +358,7 @@ checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
|
|
|
370
358
|
dependencies = [
|
|
371
359
|
"cfg-if",
|
|
372
360
|
"libc",
|
|
373
|
-
"r-efi
|
|
361
|
+
"r-efi",
|
|
374
362
|
"wasip2",
|
|
375
363
|
"wasip3",
|
|
376
364
|
]
|
|
@@ -481,15 +469,6 @@ dependencies = [
|
|
|
481
469
|
"serde_core",
|
|
482
470
|
]
|
|
483
471
|
|
|
484
|
-
[[package]]
|
|
485
|
-
name = "indoc"
|
|
486
|
-
version = "2.0.7"
|
|
487
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
488
|
-
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
489
|
-
dependencies = [
|
|
490
|
-
"rustversion",
|
|
491
|
-
]
|
|
492
|
-
|
|
493
472
|
[[package]]
|
|
494
473
|
name = "iter-read"
|
|
495
474
|
version = "1.1.0"
|
|
@@ -537,9 +516,9 @@ dependencies = [
|
|
|
537
516
|
|
|
538
517
|
[[package]]
|
|
539
518
|
name = "linux-raw-sys"
|
|
540
|
-
version = "0.
|
|
519
|
+
version = "0.12.1"
|
|
541
520
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
542
|
-
checksum = "
|
|
521
|
+
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
|
543
522
|
|
|
544
523
|
[[package]]
|
|
545
524
|
name = "lock_api"
|
|
@@ -567,9 +546,9 @@ dependencies = [
|
|
|
567
546
|
|
|
568
547
|
[[package]]
|
|
569
548
|
name = "lz4_flex"
|
|
570
|
-
version = "0.
|
|
549
|
+
version = "0.13.0"
|
|
571
550
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
572
|
-
checksum = "
|
|
551
|
+
checksum = "db9a0d582c2874f68138a16ce1867e0ffde6c0bb0a0df85e1f36d04146db488a"
|
|
573
552
|
dependencies = [
|
|
574
553
|
"twox-hash",
|
|
575
554
|
]
|
|
@@ -589,15 +568,6 @@ dependencies = [
|
|
|
589
568
|
"libc",
|
|
590
569
|
]
|
|
591
570
|
|
|
592
|
-
[[package]]
|
|
593
|
-
name = "memoffset"
|
|
594
|
-
version = "0.9.1"
|
|
595
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
596
|
-
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
597
|
-
dependencies = [
|
|
598
|
-
"autocfg",
|
|
599
|
-
]
|
|
600
|
-
|
|
601
571
|
[[package]]
|
|
602
572
|
name = "num-bigint"
|
|
603
573
|
version = "0.4.6"
|
|
@@ -713,35 +683,32 @@ dependencies = [
|
|
|
713
683
|
|
|
714
684
|
[[package]]
|
|
715
685
|
name = "pyo3"
|
|
716
|
-
version = "0.
|
|
686
|
+
version = "0.28.2"
|
|
717
687
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
718
|
-
checksum = "
|
|
688
|
+
checksum = "cf85e27e86080aafd5a22eae58a162e133a589551542b3e5cee4beb27e54f8e1"
|
|
719
689
|
dependencies = [
|
|
720
|
-
"indoc",
|
|
721
690
|
"libc",
|
|
722
|
-
"memoffset",
|
|
723
691
|
"once_cell",
|
|
724
692
|
"portable-atomic",
|
|
725
693
|
"pyo3-build-config",
|
|
726
694
|
"pyo3-ffi",
|
|
727
695
|
"pyo3-macros",
|
|
728
|
-
"unindent",
|
|
729
696
|
]
|
|
730
697
|
|
|
731
698
|
[[package]]
|
|
732
699
|
name = "pyo3-build-config"
|
|
733
|
-
version = "0.
|
|
700
|
+
version = "0.28.2"
|
|
734
701
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
735
|
-
checksum = "
|
|
702
|
+
checksum = "8bf94ee265674bf76c09fa430b0e99c26e319c945d96ca0d5a8215f31bf81cf7"
|
|
736
703
|
dependencies = [
|
|
737
704
|
"target-lexicon",
|
|
738
705
|
]
|
|
739
706
|
|
|
740
707
|
[[package]]
|
|
741
708
|
name = "pyo3-ffi"
|
|
742
|
-
version = "0.
|
|
709
|
+
version = "0.28.2"
|
|
743
710
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
744
|
-
checksum = "
|
|
711
|
+
checksum = "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc"
|
|
745
712
|
dependencies = [
|
|
746
713
|
"libc",
|
|
747
714
|
"pyo3-build-config",
|
|
@@ -749,9 +716,9 @@ dependencies = [
|
|
|
749
716
|
|
|
750
717
|
[[package]]
|
|
751
718
|
name = "pyo3-macros"
|
|
752
|
-
version = "0.
|
|
719
|
+
version = "0.28.2"
|
|
753
720
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
754
|
-
checksum = "
|
|
721
|
+
checksum = "f5d671734e9d7a43449f8480f8b38115df67bef8d21f76837fa75ee7aaa5e52e"
|
|
755
722
|
dependencies = [
|
|
756
723
|
"proc-macro2",
|
|
757
724
|
"pyo3-macros-backend",
|
|
@@ -761,9 +728,9 @@ dependencies = [
|
|
|
761
728
|
|
|
762
729
|
[[package]]
|
|
763
730
|
name = "pyo3-macros-backend"
|
|
764
|
-
version = "0.
|
|
731
|
+
version = "0.28.2"
|
|
765
732
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
766
|
-
checksum = "
|
|
733
|
+
checksum = "22faaa1ce6c430a1f71658760497291065e6450d7b5dc2bcf254d49f66ee700a"
|
|
767
734
|
dependencies = [
|
|
768
735
|
"heck",
|
|
769
736
|
"proc-macro2",
|
|
@@ -781,12 +748,6 @@ dependencies = [
|
|
|
781
748
|
"proc-macro2",
|
|
782
749
|
]
|
|
783
750
|
|
|
784
|
-
[[package]]
|
|
785
|
-
name = "r-efi"
|
|
786
|
-
version = "5.3.0"
|
|
787
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
788
|
-
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
|
789
|
-
|
|
790
751
|
[[package]]
|
|
791
752
|
name = "r-efi"
|
|
792
753
|
version = "6.0.0"
|
|
@@ -795,9 +756,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
|
|
795
756
|
|
|
796
757
|
[[package]]
|
|
797
758
|
name = "redb"
|
|
798
|
-
version = "3.1.
|
|
759
|
+
version = "3.1.1"
|
|
799
760
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
800
|
-
checksum = "
|
|
761
|
+
checksum = "ef99362319c782aa4639ad3a306b64c3bb90e12874e99b8df124cb679d988611"
|
|
801
762
|
dependencies = [
|
|
802
763
|
"libc",
|
|
803
764
|
]
|
|
@@ -859,9 +820,9 @@ dependencies = [
|
|
|
859
820
|
|
|
860
821
|
[[package]]
|
|
861
822
|
name = "rustix"
|
|
862
|
-
version = "1.1.
|
|
823
|
+
version = "1.1.4"
|
|
863
824
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
864
|
-
checksum = "
|
|
825
|
+
checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
|
|
865
826
|
dependencies = [
|
|
866
827
|
"bitflags",
|
|
867
828
|
"errno",
|
|
@@ -1003,12 +964,12 @@ checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c"
|
|
|
1003
964
|
|
|
1004
965
|
[[package]]
|
|
1005
966
|
name = "tempfile"
|
|
1006
|
-
version = "3.
|
|
967
|
+
version = "3.27.0"
|
|
1007
968
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1008
|
-
checksum = "
|
|
969
|
+
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
|
1009
970
|
dependencies = [
|
|
1010
971
|
"fastrand",
|
|
1011
|
-
"getrandom
|
|
972
|
+
"getrandom",
|
|
1012
973
|
"once_cell",
|
|
1013
974
|
"rustix",
|
|
1014
975
|
"windows-sys",
|
|
@@ -1083,12 +1044,6 @@ version = "0.2.6"
|
|
|
1083
1044
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1084
1045
|
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
|
1085
1046
|
|
|
1086
|
-
[[package]]
|
|
1087
|
-
name = "unindent"
|
|
1088
|
-
version = "0.2.4"
|
|
1089
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1090
|
-
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
1091
|
-
|
|
1092
1047
|
[[package]]
|
|
1093
1048
|
name = "unty"
|
|
1094
1049
|
version = "0.0.4"
|
|
@@ -1101,7 +1056,7 @@ version = "1.22.0"
|
|
|
1101
1056
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1102
1057
|
checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37"
|
|
1103
1058
|
dependencies = [
|
|
1104
|
-
"getrandom
|
|
1059
|
+
"getrandom",
|
|
1105
1060
|
"js-sys",
|
|
1106
1061
|
"serde_core",
|
|
1107
1062
|
"wasm-bindgen",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "diskcache_rs"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.8"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["longhao <hal.long@outlook.com>"]
|
|
6
6
|
description = "A high-performance disk cache implementation in Rust with Python bindings"
|
|
@@ -28,7 +28,7 @@ panic = "abort"
|
|
|
28
28
|
strip = "symbols"
|
|
29
29
|
|
|
30
30
|
[dependencies]
|
|
31
|
-
pyo3 = { version = "0.
|
|
31
|
+
pyo3 = { version = "0.28", features = ["extension-module"] }
|
|
32
32
|
serde = { version = "1.0", features = ["derive"] }
|
|
33
33
|
serde_json = "1.0"
|
|
34
34
|
bincode = "2.0"
|
|
@@ -41,7 +41,7 @@ rusqlite = { version = "0.39", features = ["bundled", "blob", "chrono"] }
|
|
|
41
41
|
# tokio removed - using std::thread instead for simplicity
|
|
42
42
|
parking_lot = "0.12"
|
|
43
43
|
dashmap = "6.1"
|
|
44
|
-
lz4_flex = "0.
|
|
44
|
+
lz4_flex = "0.13"
|
|
45
45
|
blake3 = "1.8"
|
|
46
46
|
bytes = "1.11"
|
|
47
47
|
memmap2 = "0.9"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Compare batch write throughput across diskcache_rs and python-diskcache."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import statistics
|
|
6
|
+
import tempfile
|
|
7
|
+
import time
|
|
8
|
+
|
|
9
|
+
import diskcache
|
|
10
|
+
from diskcache_rs import Cache, rust_pickle_dumps
|
|
11
|
+
from diskcache_rs._diskcache_rs import PyCache
|
|
12
|
+
|
|
13
|
+
PAYLOAD = {f"key-{index}": b"x" * 1024 for index in range(500)}
|
|
14
|
+
SERIALIZED_PAYLOAD = {key: rust_pickle_dumps(value) for key, value in PAYLOAD.items()}
|
|
15
|
+
ROUNDS = 5
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def benchmark_diskcache_rs_loop() -> float:
|
|
19
|
+
with tempfile.TemporaryDirectory(prefix="diskcache_rs_loop_") as cache_dir:
|
|
20
|
+
cache = Cache(cache_dir)
|
|
21
|
+
start = time.perf_counter()
|
|
22
|
+
for key, value in PAYLOAD.items():
|
|
23
|
+
cache.set(key, value)
|
|
24
|
+
cache.close()
|
|
25
|
+
return time.perf_counter() - start
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def benchmark_diskcache_rs_batch() -> float:
|
|
29
|
+
with tempfile.TemporaryDirectory(prefix="diskcache_rs_batch_") as cache_dir:
|
|
30
|
+
cache = Cache(cache_dir)
|
|
31
|
+
start = time.perf_counter()
|
|
32
|
+
cache.set_many(PAYLOAD)
|
|
33
|
+
cache.close()
|
|
34
|
+
return time.perf_counter() - start
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def benchmark_diskcache_loop() -> float:
|
|
38
|
+
with tempfile.TemporaryDirectory(prefix="diskcache_py_loop_") as cache_dir:
|
|
39
|
+
cache = diskcache.Cache(cache_dir)
|
|
40
|
+
start = time.perf_counter()
|
|
41
|
+
for key, value in PAYLOAD.items():
|
|
42
|
+
cache.set(key, value)
|
|
43
|
+
cache.close()
|
|
44
|
+
return time.perf_counter() - start
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def benchmark_pycache_loop() -> float:
|
|
48
|
+
with tempfile.TemporaryDirectory(prefix="diskcache_pycache_loop_") as cache_dir:
|
|
49
|
+
cache = PyCache(cache_dir)
|
|
50
|
+
start = time.perf_counter()
|
|
51
|
+
for key, value in SERIALIZED_PAYLOAD.items():
|
|
52
|
+
cache.set(key, value)
|
|
53
|
+
cache.close()
|
|
54
|
+
return time.perf_counter() - start
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def benchmark_pycache_batch() -> float:
|
|
58
|
+
with tempfile.TemporaryDirectory(prefix="diskcache_pycache_batch_") as cache_dir:
|
|
59
|
+
cache = PyCache(cache_dir)
|
|
60
|
+
start = time.perf_counter()
|
|
61
|
+
cache.set_many(list(SERIALIZED_PAYLOAD.items()))
|
|
62
|
+
cache.close()
|
|
63
|
+
return time.perf_counter() - start
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def main() -> None:
|
|
67
|
+
rs_loop = [benchmark_diskcache_rs_loop() for _ in range(ROUNDS)]
|
|
68
|
+
rs_batch = [benchmark_diskcache_rs_batch() for _ in range(ROUNDS)]
|
|
69
|
+
py_loop = [benchmark_diskcache_loop() for _ in range(ROUNDS)]
|
|
70
|
+
pycache_loop = [benchmark_pycache_loop() for _ in range(ROUNDS)]
|
|
71
|
+
pycache_batch = [benchmark_pycache_batch() for _ in range(ROUNDS)]
|
|
72
|
+
|
|
73
|
+
rs_loop_avg = statistics.mean(rs_loop)
|
|
74
|
+
rs_batch_avg = statistics.mean(rs_batch)
|
|
75
|
+
py_loop_avg = statistics.mean(py_loop)
|
|
76
|
+
pycache_loop_avg = statistics.mean(pycache_loop)
|
|
77
|
+
pycache_batch_avg = statistics.mean(pycache_batch)
|
|
78
|
+
|
|
79
|
+
print(f"rs_loop_avg={rs_loop_avg:.6f}")
|
|
80
|
+
print(f"rs_batch_avg={rs_batch_avg:.6f}")
|
|
81
|
+
print(f"py_loop_avg={py_loop_avg:.6f}")
|
|
82
|
+
print(f"pycache_loop_avg={pycache_loop_avg:.6f}")
|
|
83
|
+
print(f"pycache_batch_avg={pycache_batch_avg:.6f}")
|
|
84
|
+
print(f"high_level_batch_speedup_vs_rs_loop={rs_loop_avg / rs_batch_avg:.2f}")
|
|
85
|
+
print(f"low_level_batch_speedup_vs_pycache_loop={pycache_loop_avg / pycache_batch_avg:.2f}")
|
|
86
|
+
print(f"batch_speedup_vs_diskcache_loop={py_loop_avg / rs_batch_avg:.2f}")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
main()
|