diskcache-rs 0.4.5__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.
Files changed (95) hide show
  1. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/actions/build-and-test/action.yml +1 -1
  2. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/workflows/benchmark.yml +1 -1
  3. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/workflows/build-abi3.yml +4 -4
  4. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/workflows/build.yml +6 -6
  5. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/workflows/release.yml +3 -3
  6. diskcache_rs-0.4.8/.release-please-manifest.json +3 -0
  7. diskcache_rs-0.4.8/API_COMPATIBILITY.md +528 -0
  8. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/CHANGELOG.md +34 -1
  9. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/Cargo.lock +244 -74
  10. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/Cargo.toml +5 -5
  11. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/PKG-INFO +3 -3
  12. diskcache_rs-0.4.8/benchmarks/batch_write_comparison.py +90 -0
  13. diskcache_rs-0.4.8/python/diskcache_rs/__init__.py +94 -0
  14. diskcache_rs-0.4.8/python/diskcache_rs/__init__.pyi +724 -0
  15. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/python/diskcache_rs/_diskcache_rs.pyi +7 -0
  16. diskcache_rs-0.4.8/python/diskcache_rs/cache.py +2817 -0
  17. diskcache_rs-0.4.8/python/diskcache_rs/constants.py +125 -0
  18. diskcache_rs-0.4.8/python/diskcache_rs/disk.py +252 -0
  19. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/python/diskcache_rs/fast_cache.py +15 -2
  20. diskcache_rs-0.4.8/python/diskcache_rs/recipes.py +535 -0
  21. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/cache.rs +62 -6
  22. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/storage/optimized_backend.rs +209 -55
  23. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/storage.rs +2 -0
  24. diskcache_rs-0.4.8/tests/test_batch_operations.py +83 -0
  25. diskcache_rs-0.4.8/tests/test_complete_api_gaps.py +597 -0
  26. diskcache_rs-0.4.8/tests/test_full_api_compatibility.py +656 -0
  27. diskcache_rs-0.4.8/tests/test_issue_73_deterministic_hashing.py +386 -0
  28. diskcache_rs-0.4.8/tests/test_issue_78_expire_method.py +262 -0
  29. diskcache_rs-0.4.8/tests/test_recipes_and_constants.py +658 -0
  30. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/uv.lock +7 -7
  31. diskcache_rs-0.4.5/.release-please-manifest.json +0 -3
  32. diskcache_rs-0.4.5/API_COMPATIBILITY.md +0 -333
  33. diskcache_rs-0.4.5/python/diskcache_rs/__init__.py +0 -37
  34. diskcache_rs-0.4.5/python/diskcache_rs/__init__.pyi +0 -215
  35. diskcache_rs-0.4.5/python/diskcache_rs/cache.py +0 -1135
  36. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  37. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  38. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/actions/setup-diskcache-rs/action.yml +0 -0
  39. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/pull_request_template.md +0 -0
  40. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.github/workflows/ci.yml +0 -0
  41. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.gitignore +0 -0
  42. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/.pre-commit-config.yaml +0 -0
  43. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/Dockerfile.test +0 -0
  44. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/LICENSE +0 -0
  45. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/README.md +0 -0
  46. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/comprehensive_performance_test.py +0 -0
  47. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/detailed_profiling.py +0 -0
  48. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/final_performance_comparison.py +0 -0
  49. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/high_performance_test.py +0 -0
  50. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/memory_usage_test.py +0 -0
  51. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/micro_benchmark.py +0 -0
  52. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/optimization_validation_test.py +0 -0
  53. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/performance_comparison.py +0 -0
  54. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/precise_benchmark.py +0 -0
  55. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/benchmarks/set_performance_analysis.py +0 -0
  56. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/docker-compose.test.yml +0 -0
  57. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/examples/basic_usage.py +0 -0
  58. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/examples/special_chars_keys_example.py +0 -0
  59. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/justfile +0 -0
  60. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/pyproject.toml +0 -0
  61. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/python/diskcache_rs/core.py +0 -0
  62. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/python/diskcache_rs/pickle_cache.py +0 -0
  63. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/python/diskcache_rs/rust_pickle.py +0 -0
  64. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/release-please-config.json +0 -0
  65. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/renovate.json +0 -0
  66. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/scripts/generate_stubs.py +0 -0
  67. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/scripts/sync_version.py +0 -0
  68. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/scripts/test-docker-network.sh +0 -0
  69. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/error.rs +0 -0
  70. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/eviction.rs +0 -0
  71. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/lib.rs +0 -0
  72. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/memory_cache.rs +0 -0
  73. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/migration.rs +0 -0
  74. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/pickle_cache.rs +0 -0
  75. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/serialization.rs +0 -0
  76. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/storage/tests.rs +0 -0
  77. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/src/utils.rs +0 -0
  78. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/__init__.py +0 -0
  79. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/benchmark_official.py +0 -0
  80. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/conftest.py +0 -0
  81. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_api_compatibility.py +0 -0
  82. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_basic_operations.py +0 -0
  83. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_ci_benchmark.py +0 -0
  84. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_compatibility.py +0 -0
  85. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_cross_platform_network.py +0 -0
  86. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_diskcache_rs_persistence_suite.py +0 -0
  87. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_docker_network.py +0 -0
  88. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_fast_cache.py +0 -0
  89. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_issue_17_configurable_threshold.py +0 -0
  90. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_network_filesystem.py +0 -0
  91. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_performance.py +0 -0
  92. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_pickle_cache.py +0 -0
  93. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_rust_pickle_performance.py +0 -0
  94. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_special_chars_keys.py +0 -0
  95. {diskcache_rs-0.4.5 → diskcache_rs-0.4.8}/tests/test_version_and_disk_threshold.py +0 -0
@@ -55,7 +55,7 @@ runs:
55
55
 
56
56
  - name: Upload test artifacts
57
57
  if: inputs.upload-artifacts == 'true' && always()
58
- uses: actions/upload-artifact@v6
58
+ uses: actions/upload-artifact@v7
59
59
  with:
60
60
  name: ${{ inputs.artifact-name }}
61
61
  path: |
@@ -55,7 +55,7 @@ jobs:
55
55
  uv run python tests/benchmark_official.py -n 1000
56
56
 
57
57
  - name: Upload benchmark results
58
- uses: actions/upload-artifact@v6
58
+ uses: actions/upload-artifact@v7
59
59
  with:
60
60
  name: benchmark-results-${{ github.sha }}
61
61
  path: benchmark_results.json
@@ -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@v6
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@v6
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@v6
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@v6
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@v6
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@v6
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@v6
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@v6
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@v6
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@v6
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@v7
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@v3
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@v7
146
+ uses: actions/download-artifact@v8
147
147
  with:
148
148
  path: release-artifacts
149
149
  merge-multiple: true
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.4.8"
3
+ }
@@ -0,0 +1,528 @@
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
+ ---
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
+
502
+ ## Conclusion
503
+
504
+ ### Can developers just change the namespace?
505
+
506
+ **Answer**: **Yes, for ~100% of use cases** ✅
507
+
508
+ - ✅ **Basic caching** (get/set/delete): Fully compatible
509
+ - ✅ **Dictionary interface**: Fully compatible
510
+ - ✅ **Atomic operations** (incr/decr/add/pop/touch): Fully compatible
511
+ - ✅ **Memoization** (`memoize()` decorator): Fully compatible
512
+ - ✅ **Transactions** (`transact()` context manager): Fully compatible
513
+ - ✅ **Queue operations** (push/pull/peek): Fully compatible
514
+ - ✅ **Sub-caches** (cache/deque/index): Fully compatible
515
+ - ✅ **Deque and Index** classes: Fully compatible with all methods
516
+ - ✅ **Maintenance** (check/cull/expire/vacuum/reset): Fully compatible
517
+ - ✅ **Metadata** (directory/timeout/disk/stats/volume): Fully compatible
518
+ - ✅ **Tag operations** (set with tag, get with tag, evict by tag): Fully compatible
519
+ - ✅ **Expire time return** (get/pop/peek with expire_time): Fully compatible
520
+ - ✅ **Read parameter** (set/get with read=True): Fully compatible
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
527
+
528
+ **Migration is straightforward for all use cases - just change the import!** 🎉