cachebox 6.2.8__tar.gz → 6.2.10__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.
- {cachebox-6.2.8 → cachebox-6.2.10}/.github/workflows/CI.yml +96 -30
- {cachebox-6.2.8 → cachebox-6.2.10}/.github/workflows/docs.yml +2 -2
- {cachebox-6.2.8 → cachebox-6.2.10}/.github/workflows/python-test.yml +5 -5
- {cachebox-6.2.8 → cachebox-6.2.10}/Cargo.lock +26 -26
- {cachebox-6.2.8 → cachebox-6.2.10}/Cargo.toml +3 -3
- {cachebox-6.2.8 → cachebox-6.2.10}/PKG-INFO +1 -1
- {cachebox-6.2.8 → cachebox-6.2.10}/cachebox/_cachebox.py +6 -6
- {cachebox-6.2.8 → cachebox-6.2.10}/cachebox/_core.pyi +13 -23
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/algorithms.md +40 -32
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/tips.md +6 -1
- {cachebox-6.2.8 → cachebox-6.2.10}/pyproject.toml +11 -11
- cachebox-6.2.10/src/internal/lazyheap.rs +565 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/internal/linked_list.rs +80 -50
- {cachebox-6.2.8 → cachebox-6.2.10}/src/internal/utils.rs +29 -4
- {cachebox-6.2.8 → cachebox-6.2.10}/src/macro_rules.rs +25 -8
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/fifopolicy.rs +5 -4
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/lfupolicy.rs +44 -21
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/rrpolicy.rs +37 -11
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/ttlpolicy.rs +9 -9
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/vttlpolicy.rs +50 -25
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/wrapped.rs +120 -37
- {cachebox-6.2.8 → cachebox-6.2.10}/src/pyclasses/cache.rs +59 -70
- {cachebox-6.2.8 → cachebox-6.2.10}/src/pyclasses/fifocache.rs +61 -66
- {cachebox-6.2.8 → cachebox-6.2.10}/src/pyclasses/lfucache.rs +56 -61
- {cachebox-6.2.8 → cachebox-6.2.10}/src/pyclasses/lrucache.rs +60 -74
- {cachebox-6.2.8 → cachebox-6.2.10}/src/pyclasses/rrcache.rs +65 -80
- {cachebox-6.2.8 → cachebox-6.2.10}/src/pyclasses/ttlcache.rs +76 -86
- {cachebox-6.2.8 → cachebox-6.2.10}/src/pyclasses/vttlcache.rs +60 -67
- {cachebox-6.2.8 → cachebox-6.2.10}/src/typeref.rs +6 -3
- {cachebox-6.2.8 → cachebox-6.2.10}/tests/mixins.py +437 -0
- cachebox-6.2.10/tests/test_hashing.py +156 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/tests/test_impls.py +180 -2
- cachebox-6.2.10/tests/test_policy_model.py +175 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/uv.lock +349 -170
- cachebox-6.2.8/src/internal/lazyheap.rs +0 -368
- {cachebox-6.2.8 → cachebox-6.2.10}/.github/dependabot.yaml +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/.gitignore +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/AGENTS.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/LICENSE +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/LICENSE-THIRD-PARTY +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/README.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/build.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/cachebox/__init__.py +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/cachebox/_wrappers.py +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/cachebox/py.typed +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/cachebox/utils.py +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/api/impls.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/api/index.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/api/utils.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/faq.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/getting-started.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/index.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/installation.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/docs/migration.md +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/docs/mkdocs.yml +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/rust-toolchain.toml +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/rustfmt.toml +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/alloc.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/control/bitmask.rs +2 -2
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/control/group/generic.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/control/group/lsx.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/control/group/mod.rs +2 -2
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/control/group/neon.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/control/group/sse2.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/control/mod.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/control/tag.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/mod.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/raw.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/scopeguard.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/hashbrown/util.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/internal/alias.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/internal/mod.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/internal/onceinit.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/internal/pickle.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/lib.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/common.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/lrupolicy.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/mod.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/nopolicy.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/policies/traits.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/pyclasses/base.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/src/pyclasses/mod.rs +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/tests/__init__.py +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/tests/conftest.py +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/tests/test_utils.py +0 -0
- {cachebox-6.2.8 → cachebox-6.2.10}/typos.toml +0 -0
|
@@ -37,12 +37,12 @@ jobs:
|
|
|
37
37
|
with:
|
|
38
38
|
persist-credentials: false
|
|
39
39
|
|
|
40
|
-
- uses: actions/setup-python@
|
|
40
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
41
41
|
with:
|
|
42
42
|
python-version: "3.14"
|
|
43
43
|
|
|
44
44
|
- name: "Install uv"
|
|
45
|
-
uses: astral-sh/setup-uv@
|
|
45
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
46
46
|
with:
|
|
47
47
|
# zizmor: ignore[cache-poisoning]
|
|
48
48
|
enable-cache: ${{ github.event_name == 'pull_request' }}
|
|
@@ -54,24 +54,55 @@ jobs:
|
|
|
54
54
|
run: ${{ matrix.command }}
|
|
55
55
|
|
|
56
56
|
build-linux:
|
|
57
|
-
|
|
57
|
+
# The manylinux2014 i686 container can't resolve vault.centos.org on ubuntu-26.04.
|
|
58
|
+
#
|
|
59
|
+
# https://github.com/PyO3/maturin-action/issues/484
|
|
60
|
+
runs-on: ubuntu-24.04
|
|
58
61
|
strategy:
|
|
59
62
|
matrix:
|
|
60
63
|
platform:
|
|
61
|
-
- {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- {
|
|
67
|
-
|
|
64
|
+
- {
|
|
65
|
+
target: x86_64-unknown-linux-gnu,
|
|
66
|
+
arch: x86_64,
|
|
67
|
+
interpreter: *interpreters,
|
|
68
|
+
}
|
|
69
|
+
- {
|
|
70
|
+
target: i686-unknown-linux-gnu,
|
|
71
|
+
arch: x86,
|
|
72
|
+
interpreter: *interpreters,
|
|
73
|
+
}
|
|
74
|
+
- {
|
|
75
|
+
target: aarch64-unknown-linux-gnu,
|
|
76
|
+
arch: aarch64,
|
|
77
|
+
interpreter: *interpreters,
|
|
78
|
+
}
|
|
79
|
+
- {
|
|
80
|
+
target: armv7-unknown-linux-gnueabihf,
|
|
81
|
+
arch: armv7,
|
|
82
|
+
interpreter: *interpreters,
|
|
83
|
+
}
|
|
84
|
+
- {
|
|
85
|
+
target: s390x-unknown-linux-gnu,
|
|
86
|
+
arch: s390x,
|
|
87
|
+
interpreter: *interpreters,
|
|
88
|
+
}
|
|
89
|
+
- {
|
|
90
|
+
target: powerpc64le-unknown-linux-gnu,
|
|
91
|
+
arch: ppc64le,
|
|
92
|
+
interpreter: *interpreters,
|
|
93
|
+
}
|
|
94
|
+
- {
|
|
95
|
+
target: riscv64gc-unknown-linux-gnu,
|
|
96
|
+
arch: riscv64,
|
|
97
|
+
interpreter: *interpreters,
|
|
98
|
+
}
|
|
68
99
|
|
|
69
100
|
steps:
|
|
70
101
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
71
102
|
with:
|
|
72
103
|
persist-credentials: false
|
|
73
104
|
|
|
74
|
-
- uses: astral-sh/setup-uv@
|
|
105
|
+
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
75
106
|
with:
|
|
76
107
|
activate-environment: true
|
|
77
108
|
enable-cache: false
|
|
@@ -89,7 +120,7 @@ jobs:
|
|
|
89
120
|
--interpreter ${{ matrix.platform.interpreter }}
|
|
90
121
|
--compatibility pypi
|
|
91
122
|
|
|
92
|
-
- uses: actions/upload-artifact@
|
|
123
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
93
124
|
with:
|
|
94
125
|
name: wheels-linux-${{ matrix.platform.arch }}
|
|
95
126
|
path: dist
|
|
@@ -99,18 +130,38 @@ jobs:
|
|
|
99
130
|
strategy:
|
|
100
131
|
matrix:
|
|
101
132
|
platform:
|
|
102
|
-
- {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
133
|
+
- {
|
|
134
|
+
target: x86_64-unknown-linux-musl,
|
|
135
|
+
arch: x86_64,
|
|
136
|
+
interpreter: *interpreters,
|
|
137
|
+
}
|
|
138
|
+
- {
|
|
139
|
+
target: i686-unknown-linux-musl,
|
|
140
|
+
arch: x86,
|
|
141
|
+
interpreter: *interpreters,
|
|
142
|
+
}
|
|
143
|
+
- {
|
|
144
|
+
target: aarch64-unknown-linux-musl,
|
|
145
|
+
arch: aarch64,
|
|
146
|
+
interpreter: *interpreters,
|
|
147
|
+
}
|
|
148
|
+
- {
|
|
149
|
+
target: armv7-unknown-linux-musleabihf,
|
|
150
|
+
arch: armv7,
|
|
151
|
+
interpreter: *interpreters,
|
|
152
|
+
}
|
|
153
|
+
- {
|
|
154
|
+
target: riscv64gc-unknown-linux-musl,
|
|
155
|
+
arch: riscv64,
|
|
156
|
+
interpreter: *interpreters,
|
|
157
|
+
}
|
|
107
158
|
|
|
108
159
|
steps:
|
|
109
160
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
110
161
|
with:
|
|
111
162
|
persist-credentials: false
|
|
112
163
|
|
|
113
|
-
- uses: astral-sh/setup-uv@
|
|
164
|
+
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
114
165
|
with:
|
|
115
166
|
activate-environment: true
|
|
116
167
|
enable-cache: false
|
|
@@ -128,7 +179,7 @@ jobs:
|
|
|
128
179
|
--interpreter ${{ matrix.platform.interpreter }}
|
|
129
180
|
--compatibility pypi
|
|
130
181
|
|
|
131
|
-
- uses: actions/upload-artifact@
|
|
182
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
132
183
|
with:
|
|
133
184
|
name: wheels-musllinux-${{ matrix.platform.arch }}
|
|
134
185
|
path: dist
|
|
@@ -138,16 +189,31 @@ jobs:
|
|
|
138
189
|
strategy:
|
|
139
190
|
matrix:
|
|
140
191
|
platform:
|
|
141
|
-
- {
|
|
142
|
-
|
|
143
|
-
|
|
192
|
+
- {
|
|
193
|
+
runner: windows-latest,
|
|
194
|
+
target: x64,
|
|
195
|
+
arch: x64,
|
|
196
|
+
interpreter: *interpreters,
|
|
197
|
+
}
|
|
198
|
+
- {
|
|
199
|
+
runner: windows-latest,
|
|
200
|
+
target: x86,
|
|
201
|
+
arch: x86,
|
|
202
|
+
interpreter: *interpreters_without_pypy,
|
|
203
|
+
}
|
|
204
|
+
- {
|
|
205
|
+
runner: windows-11-arm,
|
|
206
|
+
target: aarch64,
|
|
207
|
+
arch: arm64,
|
|
208
|
+
interpreter: *interpreters_win_arm64,
|
|
209
|
+
}
|
|
144
210
|
|
|
145
211
|
steps:
|
|
146
212
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
147
213
|
with:
|
|
148
214
|
persist-credentials: false
|
|
149
215
|
|
|
150
|
-
- uses: actions/setup-python@
|
|
216
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
151
217
|
with:
|
|
152
218
|
python-version: "3.x"
|
|
153
219
|
architecture: ${{ matrix.platform.arch }}
|
|
@@ -163,7 +229,7 @@ jobs:
|
|
|
163
229
|
--interpreter ${{ matrix.platform.interpreter }}
|
|
164
230
|
--compatibility pypi
|
|
165
231
|
|
|
166
|
-
- uses: actions/upload-artifact@
|
|
232
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
167
233
|
with:
|
|
168
234
|
name: wheels-windows-${{ matrix.platform.target }}
|
|
169
235
|
path: dist
|
|
@@ -181,7 +247,7 @@ jobs:
|
|
|
181
247
|
with:
|
|
182
248
|
persist-credentials: false
|
|
183
249
|
|
|
184
|
-
- uses: actions/setup-python@
|
|
250
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
185
251
|
with:
|
|
186
252
|
python-version: "3.x"
|
|
187
253
|
|
|
@@ -196,7 +262,7 @@ jobs:
|
|
|
196
262
|
--interpreter ${{ matrix.platform.interpreter }}
|
|
197
263
|
--compatibility pypi
|
|
198
264
|
|
|
199
|
-
- uses: actions/upload-artifact@
|
|
265
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
200
266
|
with:
|
|
201
267
|
name: wheels-macos-${{ matrix.platform.target }}
|
|
202
268
|
path: dist
|
|
@@ -215,14 +281,14 @@ jobs:
|
|
|
215
281
|
args: --out dist
|
|
216
282
|
|
|
217
283
|
- name: Upload sdist
|
|
218
|
-
uses: actions/upload-artifact@
|
|
284
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
219
285
|
with:
|
|
220
286
|
name: wheels-sdist
|
|
221
287
|
path: dist
|
|
222
288
|
|
|
223
289
|
release:
|
|
224
290
|
runs-on: ubuntu-latest
|
|
225
|
-
if: github.ref_type == 'tag'
|
|
291
|
+
if: github.ref_type == 'tag'
|
|
226
292
|
needs:
|
|
227
293
|
- build-linux
|
|
228
294
|
- build-musllinux
|
|
@@ -235,7 +301,7 @@ jobs:
|
|
|
235
301
|
contents: write
|
|
236
302
|
|
|
237
303
|
steps:
|
|
238
|
-
- uses: actions/download-artifact@
|
|
304
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
239
305
|
with:
|
|
240
306
|
pattern: wheels-*
|
|
241
307
|
merge-multiple: true
|
|
@@ -243,6 +309,6 @@ jobs:
|
|
|
243
309
|
|
|
244
310
|
- name: Publish to PyPI
|
|
245
311
|
if: github.ref_type == 'tag'
|
|
246
|
-
uses: pypa/gh-action-pypi-publish@
|
|
312
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
247
313
|
with:
|
|
248
314
|
packages-dir: dist
|
|
@@ -15,12 +15,12 @@ jobs:
|
|
|
15
15
|
with:
|
|
16
16
|
fetch-depth: 0
|
|
17
17
|
|
|
18
|
-
- uses: actions/setup-python@
|
|
18
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
19
19
|
with:
|
|
20
20
|
python-version: 3.14
|
|
21
21
|
|
|
22
22
|
- name: "Install uv"
|
|
23
|
-
uses: astral-sh/setup-uv@
|
|
23
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
24
24
|
with:
|
|
25
25
|
enable-cache: false
|
|
26
26
|
|
|
@@ -40,19 +40,19 @@ jobs:
|
|
|
40
40
|
|
|
41
41
|
- uses: dtolnay/rust-toolchain@stable # zizmor: ignore[unpinned-uses]
|
|
42
42
|
|
|
43
|
-
- uses: Swatinem/rust-cache@
|
|
43
|
+
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
|
|
44
44
|
if: github.event_name == 'pull_request' && github.run_attempt == 1
|
|
45
45
|
with:
|
|
46
46
|
lookup-only: false # zizmor: ignore[cache-poisoning]
|
|
47
47
|
shared-key: ${{ matrix.python-version }}
|
|
48
48
|
|
|
49
|
-
- uses: actions/setup-python@
|
|
49
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
50
50
|
with:
|
|
51
51
|
python-version: ${{ matrix.python-version }}
|
|
52
52
|
allow-prereleases: true
|
|
53
53
|
|
|
54
54
|
- name: "Install uv"
|
|
55
|
-
uses: astral-sh/setup-uv@
|
|
55
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
56
56
|
with:
|
|
57
57
|
enable-cache: false
|
|
58
58
|
|
|
@@ -88,12 +88,12 @@ jobs:
|
|
|
88
88
|
|
|
89
89
|
- uses: dtolnay/rust-toolchain@stable # zizmor: ignore[unpinned-uses]
|
|
90
90
|
|
|
91
|
-
- uses: actions/setup-python@
|
|
91
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
92
92
|
with:
|
|
93
93
|
python-version: "3.13"
|
|
94
94
|
|
|
95
95
|
- name: "Install uv"
|
|
96
|
-
uses: astral-sh/setup-uv@
|
|
96
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
97
97
|
with:
|
|
98
98
|
enable-cache: false
|
|
99
99
|
|
|
@@ -37,7 +37,7 @@ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
|
|
|
37
37
|
|
|
38
38
|
[[package]]
|
|
39
39
|
name = "cachebox"
|
|
40
|
-
version = "6.2.
|
|
40
|
+
version = "6.2.10"
|
|
41
41
|
dependencies = [
|
|
42
42
|
"allocator-api2",
|
|
43
43
|
"cfg-if",
|
|
@@ -50,9 +50,9 @@ dependencies = [
|
|
|
50
50
|
|
|
51
51
|
[[package]]
|
|
52
52
|
name = "cc"
|
|
53
|
-
version = "1.
|
|
53
|
+
version = "1.9.0"
|
|
54
54
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
-
checksum = "
|
|
55
|
+
checksum = "877bf67ac8e52449eb2f9e98a344ea163beb70dd1f9eebe3cc5357dcfeaee4df"
|
|
56
56
|
dependencies = [
|
|
57
57
|
"find-msvc-tools",
|
|
58
58
|
"shlex",
|
|
@@ -91,9 +91,9 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
|
|
|
91
91
|
|
|
92
92
|
[[package]]
|
|
93
93
|
name = "find-msvc-tools"
|
|
94
|
-
version = "0.1.
|
|
94
|
+
version = "0.1.15"
|
|
95
95
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
96
|
-
checksum = "
|
|
96
|
+
checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
|
|
97
97
|
|
|
98
98
|
[[package]]
|
|
99
99
|
name = "futures-core"
|
|
@@ -162,9 +162,9 @@ dependencies = [
|
|
|
162
162
|
|
|
163
163
|
[[package]]
|
|
164
164
|
name = "libc"
|
|
165
|
-
version = "0.2.
|
|
165
|
+
version = "0.2.191"
|
|
166
166
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
167
|
-
checksum = "
|
|
167
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
168
168
|
|
|
169
169
|
[[package]]
|
|
170
170
|
name = "lock_api"
|
|
@@ -242,9 +242,9 @@ dependencies = [
|
|
|
242
242
|
|
|
243
243
|
[[package]]
|
|
244
244
|
name = "pyo3"
|
|
245
|
-
version = "0.
|
|
245
|
+
version = "0.30.1"
|
|
246
246
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
-
checksum = "
|
|
247
|
+
checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
|
|
248
248
|
dependencies = [
|
|
249
249
|
"chrono",
|
|
250
250
|
"libc",
|
|
@@ -259,18 +259,18 @@ dependencies = [
|
|
|
259
259
|
|
|
260
260
|
[[package]]
|
|
261
261
|
name = "pyo3-build-config"
|
|
262
|
-
version = "0.
|
|
262
|
+
version = "0.30.1"
|
|
263
263
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
264
|
-
checksum = "
|
|
264
|
+
checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
|
|
265
265
|
dependencies = [
|
|
266
266
|
"target-lexicon",
|
|
267
267
|
]
|
|
268
268
|
|
|
269
269
|
[[package]]
|
|
270
270
|
name = "pyo3-ffi"
|
|
271
|
-
version = "0.
|
|
271
|
+
version = "0.30.1"
|
|
272
272
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
273
|
-
checksum = "
|
|
273
|
+
checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
|
|
274
274
|
dependencies = [
|
|
275
275
|
"libc",
|
|
276
276
|
"pyo3-build-config",
|
|
@@ -278,26 +278,26 @@ dependencies = [
|
|
|
278
278
|
|
|
279
279
|
[[package]]
|
|
280
280
|
name = "pyo3-macros"
|
|
281
|
-
version = "0.
|
|
281
|
+
version = "0.30.1"
|
|
282
282
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
283
|
-
checksum = "
|
|
283
|
+
checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
|
|
284
284
|
dependencies = [
|
|
285
285
|
"proc-macro2",
|
|
286
286
|
"pyo3-macros-backend",
|
|
287
287
|
"quote",
|
|
288
|
-
"syn
|
|
288
|
+
"syn 3.0.9",
|
|
289
289
|
]
|
|
290
290
|
|
|
291
291
|
[[package]]
|
|
292
292
|
name = "pyo3-macros-backend"
|
|
293
|
-
version = "0.
|
|
293
|
+
version = "0.30.1"
|
|
294
294
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
295
|
-
checksum = "
|
|
295
|
+
checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
|
|
296
296
|
dependencies = [
|
|
297
297
|
"heck",
|
|
298
298
|
"proc-macro2",
|
|
299
299
|
"quote",
|
|
300
|
-
"syn
|
|
300
|
+
"syn 3.0.9",
|
|
301
301
|
]
|
|
302
302
|
|
|
303
303
|
[[package]]
|
|
@@ -344,9 +344,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
|
|
344
344
|
|
|
345
345
|
[[package]]
|
|
346
346
|
name = "smallvec"
|
|
347
|
-
version = "1.16.
|
|
347
|
+
version = "1.16.3"
|
|
348
348
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
349
|
-
checksum = "
|
|
349
|
+
checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b"
|
|
350
350
|
|
|
351
351
|
[[package]]
|
|
352
352
|
name = "syn"
|
|
@@ -361,9 +361,9 @@ dependencies = [
|
|
|
361
361
|
|
|
362
362
|
[[package]]
|
|
363
363
|
name = "syn"
|
|
364
|
-
version = "3.0.
|
|
364
|
+
version = "3.0.9"
|
|
365
365
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
366
|
-
checksum = "
|
|
366
|
+
checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
|
|
367
367
|
dependencies = [
|
|
368
368
|
"proc-macro2",
|
|
369
369
|
"quote",
|
|
@@ -378,9 +378,9 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
|
378
378
|
|
|
379
379
|
[[package]]
|
|
380
380
|
name = "unicode-ident"
|
|
381
|
-
version = "1.0.
|
|
381
|
+
version = "1.0.27"
|
|
382
382
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
383
|
-
checksum = "
|
|
383
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
384
384
|
|
|
385
385
|
[[package]]
|
|
386
386
|
name = "wasm-bindgen"
|
|
@@ -414,7 +414,7 @@ dependencies = [
|
|
|
414
414
|
"bumpalo",
|
|
415
415
|
"proc-macro2",
|
|
416
416
|
"quote",
|
|
417
|
-
"syn 3.0.
|
|
417
|
+
"syn 3.0.9",
|
|
418
418
|
"wasm-bindgen-shared",
|
|
419
419
|
]
|
|
420
420
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "cachebox"
|
|
3
|
-
version = "6.2.
|
|
3
|
+
version = "6.2.10"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
description = "The fastest memoizing and caching Python library written in Rust"
|
|
6
6
|
readme = "README.md"
|
|
@@ -18,10 +18,10 @@ cfg-if = "1.0.4"
|
|
|
18
18
|
chrono = "0.4.45"
|
|
19
19
|
fastrand = "2.5.0"
|
|
20
20
|
parking_lot = { version = "0.12.5", default-features = false }
|
|
21
|
-
pyo3 = { version = "0.
|
|
21
|
+
pyo3 = { version = "0.30.1", default-features = false, features = ["chrono", "macros", "parking_lot"] }
|
|
22
22
|
|
|
23
23
|
[build-dependencies]
|
|
24
|
-
pyo3-build-config = { version = "0.
|
|
24
|
+
pyo3-build-config = { version = "0.30.1", default-features = false, features = ["resolve-config"] }
|
|
25
25
|
|
|
26
26
|
[features]
|
|
27
27
|
default = ["extension-module", "inline-more"]
|
|
@@ -54,9 +54,9 @@ class TTLCache(_CoreTTLCache[KT, VT]):
|
|
|
54
54
|
``sweep_interval`` is set, a background thread performs the sweep on that
|
|
55
55
|
interval instead, reclaiming expired entries independent of method calls.
|
|
56
56
|
|
|
57
|
-
| | get | insert | delete
|
|
58
|
-
| ------------ | ----- | ------- |
|
|
59
|
-
| Worse-case | O(1) | O(
|
|
57
|
+
| | get | insert | delete | popitem |
|
|
58
|
+
| ------------ | ----- | ------- | ------ | ------- |
|
|
59
|
+
| Worse-case | O(1) | O(e)~ | O(n) | O(1)~ |
|
|
60
60
|
|
|
61
61
|
Pros:
|
|
62
62
|
- Insert, lookup, and evict are all O(1) amortized: the
|
|
@@ -225,9 +225,9 @@ class VTTLCache(_CoreVTTLCache[KT, VT]):
|
|
|
225
225
|
no TTL are the last resort and are evicted only when all expiring items
|
|
226
226
|
have been exhausted.
|
|
227
227
|
|
|
228
|
-
| | get | insert
|
|
229
|
-
| ------------ | ----- |
|
|
230
|
-
| Worse-case | O(1)~ | O(1)
|
|
228
|
+
| | get | insert | delete | popitem |
|
|
229
|
+
| ------------ | ----- | -------------- | -------------- | --------- |
|
|
230
|
+
| Worse-case | O(1)~ | O((e+1) log n) | O((e+1) log n) | O(log n)~ |
|
|
231
231
|
|
|
232
232
|
Pros:
|
|
233
233
|
- Per-item TTL control: each entry can have a different lifetime.
|
|
@@ -266,7 +266,7 @@ class Cache(BaseCacheImpl[_KT, _VT]):
|
|
|
266
266
|
|
|
267
267
|
| | get | insert | delete | popitem |
|
|
268
268
|
| ------------ | ----- | ------- | ------ | ------- |
|
|
269
|
-
| Worse-case | O(1) | O(1)
|
|
269
|
+
| Worse-case | O(1) | O(1)~ | O(1) | N/A |
|
|
270
270
|
|
|
271
271
|
Pros:
|
|
272
272
|
- Minimal overhead: no bookkeeping for eviction means lower CPU and
|
|
@@ -314,16 +314,6 @@ class Cache(BaseCacheImpl[_KT, _VT]):
|
|
|
314
314
|
```
|
|
315
315
|
"""
|
|
316
316
|
|
|
317
|
-
# | Class | get | insert | delete | popitem |
|
|
318
|
-
# |---|---|---|---|---|
|
|
319
|
-
# | \`Cache\` | O(1) | O(1) | O(1) | N/A |
|
|
320
|
-
# | \`FIFOCache\` | O(1) | O(1) | O(min(i, n-i)) | O(1) |
|
|
321
|
-
# | \`RRCache\` | O(1) | O(1) | O(1) | O(1) |
|
|
322
|
-
# | \`LRUCache\` | O(1)~ | O(1)~ | O(1)~ | O(1)~ |
|
|
323
|
-
# | \`LFUCache\` | O(1)~ | O(1)~ | O(min(i, n-i)) | O(1)~ |
|
|
324
|
-
# | \`TTLCache\` | O(1)~ | O(1)~ | O(min(i, n-i)) | O(n) |
|
|
325
|
-
# | \`VTTLCache\` | O(1)~ | O(1)~ | O(min(i, n-i)) | O(1)~ |
|
|
326
|
-
|
|
327
317
|
def insert(self, key: _KT, value: _VT) -> _VT | None:
|
|
328
318
|
"""
|
|
329
319
|
Inserts a key-value pair and returns the previous value if present.
|
|
@@ -475,9 +465,9 @@ class FIFOCache(BaseCacheImpl[_KT, _VT]):
|
|
|
475
465
|
A ``front_offset`` counter recovers physical positions at read time as
|
|
476
466
|
``entries[table[key] - front_offset]``.
|
|
477
467
|
|
|
478
|
-
| | get | insert | delete
|
|
479
|
-
| ------------ | ----- | ------- |
|
|
480
|
-
| Worse-case | O(1) | O(1)
|
|
468
|
+
| | get | insert | delete | popitem |
|
|
469
|
+
| ------------ | ----- | ------- | ------ | ------- |
|
|
470
|
+
| Worse-case | O(1) | O(1)~ | O(n) | O(1)~ |
|
|
481
471
|
|
|
482
472
|
Pros:
|
|
483
473
|
- Insert, lookup, and evict are all O(1) amortized.
|
|
@@ -668,9 +658,9 @@ class RRCache(BaseCacheImpl[_KT, _VT]):
|
|
|
668
658
|
ensuring fair treatment across all cached items regardless of access
|
|
669
659
|
patterns.
|
|
670
660
|
|
|
671
|
-
| | get | insert | delete | popitem
|
|
672
|
-
| ------------ | ----- | ------- | ------ |
|
|
673
|
-
| Worse-case | O(1) | O(1) | O(1) | O(
|
|
661
|
+
| | get | insert | delete | popitem |
|
|
662
|
+
| ------------ | ----- | ------- | ------ | ------- |
|
|
663
|
+
| Worse-case | O(1) | O(1) | O(1) | O(1) |
|
|
674
664
|
|
|
675
665
|
Pros:
|
|
676
666
|
- Low overhead: computationally cheap compared to tracking access order
|
|
@@ -863,9 +853,9 @@ class LRUCache(BaseCacheImpl[_KT, _VT]):
|
|
|
863
853
|
O(1) lookups. On every access the item is moved to the back. On eviction
|
|
864
854
|
the front item is removed. A running total enables O(1) capacity checks.
|
|
865
855
|
|
|
866
|
-
| | get
|
|
867
|
-
| ------------ |
|
|
868
|
-
| Worse-case | O(1)
|
|
856
|
+
| | get | insert | delete(i) | popitem |
|
|
857
|
+
| ------------ | ---- | ------- | --------- | ------- |
|
|
858
|
+
| Worse-case | O(1) | O(1)~ | O(1)~ | O(1)~ |
|
|
869
859
|
|
|
870
860
|
Pros:
|
|
871
861
|
- Excellent hit rates on temporal-locality workloads.
|
|
@@ -1090,9 +1080,9 @@ class LFUCache(BaseCacheImpl[_KT, _VT]):
|
|
|
1090
1080
|
minimum-frequency item is popped in O(n log n) worst-case (amortised
|
|
1091
1081
|
O(log n) under typical distributions). Lookups are O(1) via the hash map.
|
|
1092
1082
|
|
|
1093
|
-
| | get | insert
|
|
1094
|
-
| ------------ | ----- |
|
|
1095
|
-
| Worse-case | O(1)~ | O(
|
|
1083
|
+
| | get | insert | delete | popitem |
|
|
1084
|
+
| ------------ | ----- | --------- | -------- | --------- |
|
|
1085
|
+
| Worse-case | O(1)~ | O(log n)~ | O(log n) | O(log n)~ |
|
|
1096
1086
|
|
|
1097
1087
|
Pros:
|
|
1098
1088
|
- Frequency-aware eviction protects hot items under heavy cache
|