diskcache-rs 0.4.0__tar.gz → 0.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/actions/build-and-test/action.yml +2 -2
  2. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/workflows/benchmark.yml +2 -2
  3. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/workflows/build-abi3.yml +7 -7
  4. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/workflows/build.yml +12 -12
  5. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/workflows/ci.yml +6 -6
  6. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/workflows/release.yml +1 -1
  7. diskcache_rs-0.4.3/.release-please-manifest.json +3 -0
  8. diskcache_rs-0.4.3/API_COMPATIBILITY.md +333 -0
  9. diskcache_rs-0.4.3/CHANGELOG.md +259 -0
  10. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/Cargo.lock +1 -1
  11. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/Cargo.toml +1 -1
  12. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/PKG-INFO +8 -23
  13. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/README.md +7 -22
  14. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/justfile +0 -18
  15. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/python/diskcache_rs/__init__.py +2 -12
  16. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/python/diskcache_rs/cache.py +523 -4
  17. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/release-please-config.json +0 -5
  18. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/lib.rs +3 -0
  19. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/storage/optimized_backend.rs +149 -0
  20. diskcache_rs-0.4.3/tests/test_api_compatibility.py +538 -0
  21. diskcache_rs-0.4.3/tests/test_diskcache_rs_persistence_suite.py +238 -0
  22. diskcache_rs-0.4.0/.cz.toml +0 -18
  23. diskcache_rs-0.4.0/.github/workflows/bump-version.yml +0 -33
  24. diskcache_rs-0.4.0/.release-please-manifest.json +0 -3
  25. diskcache_rs-0.4.0/CHANGELOG.md +0 -132
  26. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  27. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  28. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/actions/setup-diskcache-rs/action.yml +0 -0
  29. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.github/pull_request_template.md +0 -0
  30. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.gitignore +0 -0
  31. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/.pre-commit-config.yaml +0 -0
  32. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/Dockerfile.test +0 -0
  33. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/LICENSE +0 -0
  34. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/comprehensive_performance_test.py +0 -0
  35. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/detailed_profiling.py +0 -0
  36. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/final_performance_comparison.py +0 -0
  37. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/high_performance_test.py +0 -0
  38. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/memory_usage_test.py +0 -0
  39. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/micro_benchmark.py +0 -0
  40. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/optimization_validation_test.py +0 -0
  41. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/performance_comparison.py +0 -0
  42. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/precise_benchmark.py +0 -0
  43. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/benchmarks/set_performance_analysis.py +0 -0
  44. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/docker-compose.test.yml +0 -0
  45. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/examples/basic_usage.py +0 -0
  46. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/pyproject.toml +0 -0
  47. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/python/diskcache_rs/__init__.pyi +0 -0
  48. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/python/diskcache_rs/_diskcache_rs.pyi +0 -0
  49. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/python/diskcache_rs/core.py +0 -0
  50. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/python/diskcache_rs/fast_cache.py +0 -0
  51. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/python/diskcache_rs/pickle_cache.py +0 -0
  52. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/python/diskcache_rs/rust_pickle.py +0 -0
  53. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/renovate.json +0 -0
  54. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/scripts/generate_stubs.py +0 -0
  55. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/scripts/sync_version.py +0 -0
  56. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/scripts/test-docker-network.sh +0 -0
  57. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/cache.rs +0 -0
  58. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/error.rs +0 -0
  59. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/eviction.rs +0 -0
  60. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/memory_cache.rs +0 -0
  61. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/migration.rs +0 -0
  62. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/pickle_cache.rs +0 -0
  63. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/serialization.rs +0 -0
  64. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/storage/tests.rs +0 -0
  65. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/storage.rs +0 -0
  66. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/src/utils.rs +0 -0
  67. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/__init__.py +0 -0
  68. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/benchmark_official.py +0 -0
  69. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/conftest.py +0 -0
  70. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_basic_operations.py +0 -0
  71. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_ci_benchmark.py +0 -0
  72. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_compatibility.py +0 -0
  73. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_cross_platform_network.py +0 -0
  74. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_docker_network.py +0 -0
  75. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_fast_cache.py +0 -0
  76. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_issue_17_configurable_threshold.py +0 -0
  77. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_network_filesystem.py +0 -0
  78. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_performance.py +0 -0
  79. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_pickle_cache.py +0 -0
  80. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_rust_pickle_performance.py +0 -0
  81. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/tests/test_version_and_disk_threshold.py +0 -0
  82. {diskcache_rs-0.4.0 → diskcache_rs-0.4.3}/uv.lock +0 -0
@@ -32,7 +32,7 @@ runs:
32
32
  shell: bash
33
33
  run: |
34
34
  uv run pyo3-stubgen diskcache_rs._diskcache_rs python/diskcache_rs/
35
- echo "✅ Type stubs generated successfully"
35
+ echo "Type stubs generated successfully"
36
36
 
37
37
  - name: Run basic tests
38
38
  if: inputs.test-type == 'basic'
@@ -51,7 +51,7 @@ runs:
51
51
  - name: Verify import
52
52
  shell: bash
53
53
  run: |
54
- uv run python -c 'import diskcache_rs; print(f"✅ diskcache_rs v{diskcache_rs.__version__} imported successfully")'
54
+ uv run python -c 'import diskcache_rs; print(f"diskcache_rs v{diskcache_rs.__version__} imported successfully")'
55
55
 
56
56
  - name: Upload test artifacts
57
57
  if: inputs.upload-artifacts == 'true' && always()
@@ -21,11 +21,11 @@ jobs:
21
21
  name: Performance Comparison
22
22
  runs-on: ubuntu-latest
23
23
  steps:
24
- - uses: actions/checkout@v4
24
+ - uses: actions/checkout@v6
25
25
  with:
26
26
  fetch-depth: 0
27
27
 
28
- - uses: actions/setup-python@v5
28
+ - uses: actions/setup-python@v6
29
29
  with:
30
30
  python-version: '3.14'
31
31
 
@@ -19,8 +19,8 @@ jobs:
19
19
  matrix:
20
20
  target: [x86_64, i686]
21
21
  steps:
22
- - uses: actions/checkout@v4
23
- - uses: actions/setup-python@v5
22
+ - uses: actions/checkout@v6
23
+ - uses: actions/setup-python@v6
24
24
  with:
25
25
  python-version: '3.14'
26
26
  architecture: x64
@@ -49,8 +49,8 @@ jobs:
49
49
  matrix:
50
50
  target: [x64, x86]
51
51
  steps:
52
- - uses: actions/checkout@v4
53
- - uses: actions/setup-python@v5
52
+ - uses: actions/checkout@v6
53
+ - uses: actions/setup-python@v6
54
54
  with:
55
55
  python-version: '3.14'
56
56
  architecture: ${{ matrix.target }}
@@ -78,8 +78,8 @@ jobs:
78
78
  matrix:
79
79
  target: [x86_64, aarch64]
80
80
  steps:
81
- - uses: actions/checkout@v4
82
- - uses: actions/setup-python@v5
81
+ - uses: actions/checkout@v6
82
+ - uses: actions/setup-python@v6
83
83
  with:
84
84
  python-version: '3.14'
85
85
  architecture: x64
@@ -104,7 +104,7 @@ jobs:
104
104
  sdist-abi3:
105
105
  runs-on: ubuntu-latest
106
106
  steps:
107
- - uses: actions/checkout@v4
107
+ - uses: actions/checkout@v6
108
108
  - name: Build sdist
109
109
  uses: PyO3/maturin-action@v1
110
110
  with:
@@ -22,8 +22,8 @@ jobs:
22
22
  matrix:
23
23
  target: [x86_64, i686]
24
24
  steps:
25
- - uses: actions/checkout@v4
26
- - uses: actions/setup-python@v5
25
+ - uses: actions/checkout@v6
26
+ - uses: actions/setup-python@v6
27
27
  with:
28
28
  python-version: '3.14'
29
29
  architecture: x64
@@ -52,8 +52,8 @@ jobs:
52
52
  matrix:
53
53
  target: [aarch64, armv7]
54
54
  steps:
55
- - uses: actions/checkout@v4
56
- - uses: actions/setup-python@v5
55
+ - uses: actions/checkout@v6
56
+ - uses: actions/setup-python@v6
57
57
  with:
58
58
  python-version: '3.14'
59
59
  - name: Build wheels
@@ -93,8 +93,8 @@ jobs:
93
93
  - x86_64-unknown-linux-musl
94
94
  - i686-unknown-linux-musl
95
95
  steps:
96
- - uses: actions/checkout@v4
97
- - uses: actions/setup-python@v5
96
+ - uses: actions/checkout@v6
97
+ - uses: actions/setup-python@v6
98
98
  with:
99
99
  python-version: '3.14'
100
100
  architecture: x64
@@ -141,8 +141,8 @@ jobs:
141
141
  - target: armv7-unknown-linux-musleabihf
142
142
  arch: armv7
143
143
  steps:
144
- - uses: actions/checkout@v4
145
- - uses: actions/setup-python@v5
144
+ - uses: actions/checkout@v6
145
+ - uses: actions/setup-python@v6
146
146
  with:
147
147
  python-version: '3.14'
148
148
  - name: Build wheels
@@ -185,8 +185,8 @@ jobs:
185
185
  matrix:
186
186
  target: [x64, x86]
187
187
  steps:
188
- - uses: actions/checkout@v4
189
- - uses: actions/setup-python@v5
188
+ - uses: actions/checkout@v6
189
+ - uses: actions/setup-python@v6
190
190
  with:
191
191
  python-version: '3.14'
192
192
  architecture: ${{ matrix.target }}
@@ -211,8 +211,8 @@ jobs:
211
211
  macos:
212
212
  runs-on: macos-latest
213
213
  steps:
214
- - uses: actions/checkout@v4
215
- - uses: actions/setup-python@v5
214
+ - uses: actions/checkout@v6
215
+ - uses: actions/setup-python@v6
216
216
  with:
217
217
  python-version: '3.14'
218
218
  architecture: x64
@@ -22,7 +22,7 @@ jobs:
22
22
  python-version: ["3.8", "3.10", "3.12"] # Test min, stable, and recent
23
23
 
24
24
  steps:
25
- - uses: actions/checkout@v4
25
+ - uses: actions/checkout@v6
26
26
 
27
27
  - name: Setup DiskCache RS Environment
28
28
  uses: ./.github/actions/setup-diskcache-rs
@@ -48,7 +48,7 @@ jobs:
48
48
  python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
49
49
 
50
50
  steps:
51
- - uses: actions/checkout@v4
51
+ - uses: actions/checkout@v6
52
52
 
53
53
  - name: Setup DiskCache RS Environment
54
54
  uses: ./.github/actions/setup-diskcache-rs
@@ -68,7 +68,7 @@ jobs:
68
68
  name: Code Quality
69
69
  runs-on: ubuntu-latest
70
70
  steps:
71
- - uses: actions/checkout@v4
71
+ - uses: actions/checkout@v6
72
72
 
73
73
  - name: Setup DiskCache RS Environment
74
74
  uses: ./.github/actions/setup-diskcache-rs
@@ -100,11 +100,11 @@ jobs:
100
100
  - name: Check all required jobs
101
101
  run: |
102
102
  if [[ "${{ needs.quick-test.result }}" != "success" ]]; then
103
- echo "❌ Quick tests failed"
103
+ echo "ERROR: Quick tests failed"
104
104
  exit 1
105
105
  fi
106
106
  if [[ "${{ needs.lint.result }}" != "success" ]]; then
107
- echo "❌ Linting failed"
107
+ echo "ERROR: Linting failed"
108
108
  exit 1
109
109
  fi
110
- echo "✅ All required CI checks passed"
110
+ echo "SUCCESS: All required CI checks passed"
@@ -115,7 +115,7 @@ jobs:
115
115
  attestations: write # Required for artifact attestation
116
116
 
117
117
  steps:
118
- - uses: actions/checkout@v5
118
+ - uses: actions/checkout@v6
119
119
  with:
120
120
  fetch-depth: 0
121
121
 
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.4.3"
3
+ }
@@ -0,0 +1,333 @@
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**: ✅ **~95% Compatible (v0.4.3+)** - Core operations, atomic operations, memoization, transactions, and iteration fully compatible. Only advanced features like tags and queues remain unimplemented.
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
+ | `__len__()` | ✅ | ✅ | Compatible |
24
+ | `get(key, default, ...)` | ✅ | ✅ | Compatible |
25
+ | `set(key, value, expire, ...)` | ✅ | ✅ | Compatible |
26
+ | `delete(key, retry)` | ✅ | ✅ | Compatible |
27
+ | `add(key, value, expire, ...)` | ✅ | ✅ | Compatible |
28
+ | `pop(key, default, ...)` | ✅ | ✅ | Compatible |
29
+ | `clear(retry)` | ✅ | ✅ | Compatible |
30
+ | `incr(key, delta, default)` | ✅ | ✅ | Compatible |
31
+ | `decr(key, delta, default)` | ✅ | ✅ | Compatible |
32
+ | `touch(key, expire)` | ✅ | ✅ | Compatible |
33
+ | `stats(enable, reset)` | ✅ | ✅ | Compatible |
34
+ | `volume()` | ✅ | ✅ | Compatible |
35
+ | `close()` | ✅ | ✅ | Compatible |
36
+ | `__enter__()` / `__exit__()` | ✅ | ✅ | Context manager support |
37
+ | `memoize(name, typed, expire, tag, ignore)` | ✅ | ✅ | Compatible (v0.4.3+) |
38
+ | `transact(retry)` | ✅ | ✅ | Compatible (v0.4.3+) |
39
+ | `iterkeys(reverse)` | ✅ | ✅ | Compatible (v0.4.3+) |
40
+ | `__reversed__()` | ✅ | ✅ | Compatible (v0.4.3+) |
41
+ | `peekitem(last, expire_time, tag, retry)` | ✅ | ✅ | Compatible (v0.4.3+) |
42
+ | `directory` (property) | ✅ | ✅ | Compatible (v0.4.3+) |
43
+ | `timeout` (property) | ✅ | ✅ | Compatible (v0.4.3+) |
44
+
45
+ ### ⚠️ Partially Compatible Methods
46
+
47
+ | Method | diskcache | diskcache_rs | Status | Notes |
48
+ |--------|-----------|--------------|--------|-------|
49
+ | `get(..., expire_time=True)` | ✅ | ⚠️ | Returns None | Not implemented |
50
+ | `get(..., tag=True)` | ✅ | ⚠️ | Returns None | Not implemented |
51
+ | `get(..., read=True)` | ✅ | ⚠️ | Ignored | File handle not supported |
52
+ | `set(..., read=True)` | ✅ | ⚠️ | Ignored | File handle not supported |
53
+ | `set(..., tag=...)` | ✅ | ⚠️ | Ignored | Tag not stored |
54
+
55
+ ### ❌ Missing Methods (Advanced Features)
56
+
57
+ | Method | diskcache | diskcache_rs | Impact |
58
+ |--------|-----------|--------------|--------|
59
+ | `check(fix, retry)` | ✅ | ❌ | Medium - debugging tool |
60
+ | `create_tag_index()` | ✅ | ❌ | Low - tag feature not supported |
61
+ | `drop_tag_index()` | ✅ | ❌ | Low - tag feature not supported |
62
+ | `cull(retry)` | ✅ | ❌ | Medium - eviction policy |
63
+ | `evict(tag, retry)` | ✅ | ❌ | Low - tag feature not supported |
64
+ | `expire(now, retry)` | ✅ | ❌ | Medium - manual expiration |
65
+ | `peek(prefix, ...)` | ✅ | ❌ | Medium - queue operations |
66
+ | `pull(prefix, ...)` | ✅ | ❌ | Medium - queue operations |
67
+ | `push(value, prefix, ...)` | ✅ | ❌ | Medium - queue operations |
68
+ | `read(key, retry)` | ✅ | ❌ | Low - file handle feature |
69
+ | `reset(key, value, ...)` | ✅ | ❌ | Low - settings management |
70
+ | `disk` (property) | ✅ | ❌ | Low - internal detail |
71
+
72
+ ---
73
+
74
+ ## FanoutCache Class API Comparison
75
+
76
+ ### ✅ Fully Compatible Methods
77
+
78
+ | Method | diskcache | diskcache_rs | Notes |
79
+ |--------|-----------|--------------|-------|
80
+ | `__init__(directory, shards, ...)` | ✅ | ✅ | Compatible |
81
+ | `__contains__(key)` | ✅ | ✅ | Compatible |
82
+ | `__getitem__(key)` | ✅ | ✅ | Compatible |
83
+ | `__setitem__(key, value)` | ✅ | ✅ | Compatible |
84
+ | `__delitem__(key)` | ✅ | ✅ | Compatible |
85
+ | `__iter__()` | ✅ | ✅ | Compatible |
86
+ | `__len__()` | ✅ | ✅ | Compatible |
87
+ | `get(key, default, ...)` | ✅ | ✅ | Compatible |
88
+ | `set(key, value, expire, ...)` | ✅ | ✅ | Compatible |
89
+ | `delete(key, retry)` | ✅ | ✅ | Compatible |
90
+ | `clear(retry)` | ✅ | ✅ | Compatible |
91
+ | `stats(enable, reset)` | ✅ | ✅ | Compatible |
92
+ | `volume()` | ✅ | ✅ | Compatible |
93
+ | `close()` | ✅ | ✅ | Compatible |
94
+ | `__enter__()` / `__exit__()` | ✅ | ✅ | Context manager support |
95
+
96
+ ### ✅ Newly Added Methods (FanoutCache) - v0.4.2+
97
+
98
+ | Method | diskcache | diskcache_rs | Status |
99
+ |--------|-----------|--------------|--------|
100
+ | `add(key, value, ...)` | ✅ | ✅ | **NEW** - Atomic add |
101
+ | `incr(key, delta, ...)` | ✅ | ✅ | **NEW** - Increment |
102
+ | `decr(key, delta, ...)` | ✅ | ✅ | **NEW** - Decrement |
103
+ | `pop(key, default, ...)` | ✅ | ✅ | **NEW** - Atomic pop |
104
+ | `touch(key, expire, ...)` | ✅ | ✅ | **NEW** - Update expiration |
105
+
106
+ ### ❌ Missing Methods (FanoutCache)
107
+
108
+ | Method | diskcache | diskcache_rs | Impact |
109
+ |--------|-----------|--------------|--------|
110
+ | `__reversed__()` | ✅ | ❌ | Low |
111
+ | `check(fix, retry)` | ✅ | ❌ | Medium |
112
+ | `create_tag_index()` | ✅ | ❌ | Low |
113
+ | `drop_tag_index()` | ✅ | ❌ | Low |
114
+ | `cull(retry)` | ✅ | ❌ | Medium |
115
+ | `evict(tag, retry)` | ✅ | ❌ | Low |
116
+ | `expire(retry)` | ✅ | ❌ | Medium |
117
+ | `memoize(...)` | ✅ | ❌ | **High** |
118
+ | `read(key)` | ✅ | ❌ | Low |
119
+ | `reset(key, value)` | ✅ | ❌ | Low |
120
+ | `transact(retry)` | ✅ | ❌ | **High** |
121
+ | `cache(name, ...)` | ✅ | ❌ | Medium - sub-cache |
122
+ | `deque(name, ...)` | ✅ | ❌ | Medium - deque support |
123
+ | `index(name)` | ✅ | ❌ | Medium - index support |
124
+ | `directory` (property) | ✅ | ❌ | Low |
125
+
126
+ ---
127
+
128
+ ## Migration Impact Assessment
129
+
130
+ ### ✅ **Low-Risk Migration** (Simple Use Cases)
131
+
132
+ If your code only uses:
133
+ - Basic get/set/delete operations
134
+ - Dictionary-style access (`cache[key]`, `key in cache`)
135
+ - Iteration and length
136
+ - Context managers (`with cache:`)
137
+ - Basic statistics
138
+
139
+ **Migration**: Simply change `import diskcache` to `import diskcache_rs` ✅
140
+
141
+ ### ✅ **Medium-Risk Migration** (Advanced Features) - NOW SUPPORTED
142
+
143
+ If your code uses:
144
+ - `incr()`/`decr()` operations
145
+ - `add()` for atomic operations
146
+ - `touch()` to update expiration
147
+ - `pop()` to atomically remove and return
148
+
149
+ **Migration**:
150
+ - `Cache` class: ✅ Fully supported
151
+ - `FanoutCache` class: ✅ **NOW FULLY SUPPORTED** (v0.4.2+)
152
+
153
+ ⚠️ Still missing:
154
+ - Queue operations (`push`/`pull`/`peek`) - Not implemented
155
+
156
+ ### ❌ **High-Risk Migration** (Breaking Changes)
157
+
158
+ If your code uses:
159
+ - **`memoize()` decorator** - Not implemented
160
+ - **`transact()` context manager** - Not implemented
161
+ - **Tag-based operations** (`evict(tag)`, tag indexes) - Not implemented
162
+ - **File handle operations** (`read=True` parameter) - Not implemented
163
+ - **Queue operations** (`push`/`pull`/`peek`) - Not implemented
164
+ - **Sub-caches** (`cache.cache(name)`, `cache.deque(name)`, `cache.index(name)`) - Not implemented
165
+
166
+ **Migration**: ❌ Requires code refactoring or feature implementation
167
+
168
+ ---
169
+
170
+ ## Recommendations
171
+
172
+ ### For Drop-in Replacement Compatibility
173
+
174
+ To achieve true drop-in replacement, implement these **high-priority** missing methods:
175
+
176
+ #### Cache Class (Priority Order)
177
+
178
+ 1. **Critical** (Widely Used):
179
+ - `memoize()` - Decorator for function memoization
180
+ - `transact()` - Transaction context manager
181
+
182
+ 2. **High** (Common Use Cases):
183
+ - `add()` for FanoutCache - Atomic add operation
184
+ - `incr()`/`decr()` for FanoutCache - Counter operations
185
+ - `pop()` for FanoutCache - Atomic pop operation
186
+ - `touch()` for FanoutCache - Update expiration
187
+
188
+ 3. **Medium** (Nice to Have):
189
+ - `expire()` - Manual expiration cleanup
190
+ - `cull()` - Manual eviction
191
+ - `push()`/`pull()`/`peek()` - Queue operations
192
+ - `directory`, `timeout` properties - Metadata access
193
+
194
+ 4. **Low** (Rarely Used):
195
+ - `__reversed__()` - Reverse iteration
196
+ - `iterkeys()` - Alternative iteration
197
+ - `check()` - Consistency checking
198
+ - Tag-based features - Tag indexing and eviction
199
+
200
+ ### Current Compatibility Score (v0.4.2+)
201
+
202
+ | Category | Score | Details |
203
+ |----------|-------|---------|
204
+ | **Core Operations** | 100% | ✅ get, set, delete, clear, contains, iteration |
205
+ | **Dictionary Interface** | 100% | ✅ `[]`, `in`, `len()`, `iter()` |
206
+ | **Atomic Operations** | 100% | ✅ Cache & FanoutCache: incr/decr/add/pop/touch |
207
+ | **Advanced Features** | 20% | ❌ memoize, transact, tags, queues |
208
+ | **Overall** | **80%** | ⬆️ **+10%** - Excellent for most use cases |
209
+
210
+ ---
211
+
212
+ ## Example Migration Scenarios
213
+
214
+ ### ✅ Scenario 1: Simple Cache (Works Out of Box)
215
+
216
+ ```python
217
+ # Before (diskcache)
218
+ from diskcache import Cache
219
+
220
+ cache = Cache('/tmp/mycache')
221
+ cache['key'] = 'value'
222
+ print(cache['key'])
223
+ del cache['key']
224
+
225
+ # After (diskcache_rs) - NO CHANGES NEEDED
226
+ from diskcache_rs import Cache
227
+
228
+ cache = Cache('/tmp/mycache')
229
+ cache['key'] = 'value'
230
+ print(cache['key'])
231
+ del cache['key']
232
+ ```
233
+
234
+ ### ✅ Scenario 2: Counter Operations (Works for Cache)
235
+
236
+ ```python
237
+ # Before (diskcache)
238
+ from diskcache import Cache
239
+
240
+ cache = Cache('/tmp/mycache')
241
+ cache.incr('counter', 1)
242
+ cache.decr('counter', 1)
243
+
244
+ # After (diskcache_rs) - NO CHANGES NEEDED
245
+ from diskcache_rs import Cache
246
+
247
+ cache = Cache('/tmp/mycache')
248
+ cache.incr('counter', 1)
249
+ cache.decr('counter', 1)
250
+ ```
251
+
252
+ ### ✅ Scenario 3: FanoutCache Counters (NOW WORKS - v0.4.2+)
253
+
254
+ ```python
255
+ # Before (diskcache)
256
+ from diskcache import FanoutCache
257
+
258
+ cache = FanoutCache('/tmp/mycache')
259
+ cache.incr('counter', 1) # ✅ Works
260
+
261
+ # After (diskcache_rs) - NOW WORKS!
262
+ from diskcache_rs import FanoutCache
263
+
264
+ cache = FanoutCache('/tmp/mycache')
265
+ cache.incr('counter', 1) # ✅ Works (v0.4.2+)
266
+ cache.decr('counter', 1) # ✅ Works (v0.4.2+)
267
+ cache.add('key', 'value') # ✅ Works (v0.4.2+)
268
+ cache.pop('key') # ✅ Works (v0.4.2+)
269
+ cache.touch('key', expire=60) # ✅ Works (v0.4.2+)
270
+ ```
271
+
272
+ ### ❌ Scenario 4: Memoization (Not Supported)
273
+
274
+ ```python
275
+ # Before (diskcache)
276
+ from diskcache import Cache
277
+
278
+ cache = Cache('/tmp/mycache')
279
+
280
+ @cache.memoize()
281
+ def expensive_function(x):
282
+ return x * x
283
+
284
+ # After (diskcache_rs) - NOT SUPPORTED
285
+ from diskcache_rs import Cache
286
+
287
+ cache = Cache('/tmp/mycache')
288
+
289
+ @cache.memoize() # ❌ AttributeError: 'Cache' object has no attribute 'memoize'
290
+ def expensive_function(x):
291
+ return x * x
292
+ ```
293
+
294
+ ---
295
+
296
+ ## Conclusion
297
+
298
+ ### Can developers just change the namespace?
299
+
300
+ **Answer**: **Yes, for 80% of use cases** ✅ (v0.4.2+)
301
+
302
+ - ✅ **Basic caching** (get/set/delete): Fully compatible
303
+ - ✅ **Dictionary interface**: Fully compatible
304
+ - ✅ **Atomic operations** (incr/decr/add/pop/touch): **Fully compatible** (Cache & FanoutCache)
305
+ - ✅ **Expiration management** (expire, touch): Fully compatible
306
+ - ✅ **Statistics & monitoring** (stats, volume): Fully compatible
307
+ - ❌ **Decorators & transactions**: Not supported, requires refactoring
308
+ - ❌ **Tag-based operations**: Not supported
309
+ - ❌ **Queue operations**: Not supported
310
+
311
+ ### Recommended Next Steps
312
+
313
+ 1. ✅ ~~**Implement FanoutCache missing methods**~~ - **DONE in v0.4.2**
314
+ 2. **Implement `memoize()` decorator** - High-value feature for users
315
+ 3. **Implement `transact()` context manager** - Important for atomic operations
316
+ 4. **Document incompatibilities** - Clear migration guide for users
317
+ 5. **Add compatibility layer** - Optional wrapper for 100% compatibility
318
+
319
+ ### Final Verdict (Updated for v0.4.2)
320
+
321
+ **diskcache_rs is now an excellent drop-in replacement for most use cases (80% compatibility)**, including:
322
+ - ✅ All basic caching operations
323
+ - ✅ All atomic operations (incr/decr/add/pop/touch)
324
+ - ✅ Both Cache and FanoutCache classes
325
+ - ✅ Context manager support
326
+ - ✅ Statistics and monitoring
327
+
328
+ Users relying on advanced features (memoization, transactions, tags, queues) will need to either:
329
+ - Wait for feature implementation
330
+ - Refactor their code
331
+ - Use a compatibility wrapper
332
+
333
+ **Migration is straightforward for 80% of use cases - just change the import!** 🎉