cachebox 6.2.4__tar.gz → 6.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. {cachebox-6.2.4 → cachebox-6.2.6}/.github/workflows/CI.yml +7 -5
  2. {cachebox-6.2.4 → cachebox-6.2.6}/.github/workflows/docs.yml +1 -1
  3. {cachebox-6.2.4 → cachebox-6.2.6}/.github/workflows/python-test.yml +3 -3
  4. {cachebox-6.2.4 → cachebox-6.2.6}/Cargo.lock +37 -37
  5. {cachebox-6.2.4 → cachebox-6.2.6}/Cargo.toml +3 -3
  6. {cachebox-6.2.4 → cachebox-6.2.6}/PKG-INFO +7 -5
  7. {cachebox-6.2.4 → cachebox-6.2.6}/README.md +6 -4
  8. {cachebox-6.2.4 → cachebox-6.2.6}/cachebox/_cachebox.py +18 -16
  9. {cachebox-6.2.4 → cachebox-6.2.6}/cachebox/_core.pyi +65 -28
  10. {cachebox-6.2.4 → cachebox-6.2.6}/cachebox/_wrappers.py +20 -18
  11. {cachebox-6.2.4 → cachebox-6.2.6}/cachebox/utils.py +22 -30
  12. cachebox-6.2.6/docs/docs/algorithms.md +280 -0
  13. {cachebox-6.2.4 → cachebox-6.2.6}/docs/docs/api/impls.md +10 -2
  14. cachebox-6.2.6/docs/docs/api/index.md +71 -0
  15. {cachebox-6.2.4 → cachebox-6.2.6}/docs/docs/api/utils.md +20 -0
  16. cachebox-6.2.6/docs/docs/faq.md +164 -0
  17. cachebox-6.2.6/docs/docs/getting-started.md +421 -0
  18. cachebox-6.2.6/docs/docs/index.md +94 -0
  19. cachebox-6.2.6/docs/docs/installation.md +58 -0
  20. cachebox-6.2.6/docs/docs/migration.md +156 -0
  21. cachebox-6.2.6/docs/docs/tips.md +361 -0
  22. {cachebox-6.2.4 → cachebox-6.2.6}/docs/mkdocs.yml +4 -2
  23. {cachebox-6.2.4 → cachebox-6.2.6}/src/internal/lazyheap.rs +18 -0
  24. {cachebox-6.2.4 → cachebox-6.2.6}/src/internal/linked_list.rs +13 -0
  25. {cachebox-6.2.4 → cachebox-6.2.6}/src/internal/utils.rs +38 -0
  26. {cachebox-6.2.4 → cachebox-6.2.6}/src/macro_rules.rs +27 -0
  27. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/fifopolicy.rs +1 -0
  28. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/lfupolicy.rs +1 -0
  29. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/lrupolicy.rs +8 -1
  30. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/nopolicy.rs +1 -0
  31. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/rrpolicy.rs +1 -0
  32. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/traits.rs +1 -0
  33. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/ttlpolicy.rs +1 -0
  34. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/vttlpolicy.rs +1 -0
  35. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/wrapped.rs +1 -1
  36. {cachebox-6.2.4 → cachebox-6.2.6}/src/pyclasses/cache.rs +15 -11
  37. {cachebox-6.2.4 → cachebox-6.2.6}/src/pyclasses/fifocache.rs +15 -11
  38. {cachebox-6.2.4 → cachebox-6.2.6}/src/pyclasses/lfucache.rs +15 -11
  39. {cachebox-6.2.4 → cachebox-6.2.6}/src/pyclasses/lrucache.rs +15 -11
  40. {cachebox-6.2.4 → cachebox-6.2.6}/src/pyclasses/rrcache.rs +15 -11
  41. {cachebox-6.2.4 → cachebox-6.2.6}/src/pyclasses/ttlcache.rs +29 -12
  42. {cachebox-6.2.4 → cachebox-6.2.6}/src/pyclasses/vttlcache.rs +29 -12
  43. {cachebox-6.2.4 → cachebox-6.2.6}/tests/mixins.py +50 -10
  44. {cachebox-6.2.4 → cachebox-6.2.6}/tests/test_impls.py +87 -0
  45. cachebox-6.2.4/docs/docs/api/index.md +0 -4
  46. cachebox-6.2.4/docs/docs/getting-started.md +0 -322
  47. cachebox-6.2.4/docs/docs/index.md +0 -76
  48. cachebox-6.2.4/docs/docs/installation.md +0 -32
  49. cachebox-6.2.4/docs/docs/migration.md +0 -140
  50. cachebox-6.2.4/docs/docs/tips.md +0 -310
  51. {cachebox-6.2.4 → cachebox-6.2.6}/.github/dependabot.yaml +0 -0
  52. {cachebox-6.2.4 → cachebox-6.2.6}/.gitignore +0 -0
  53. {cachebox-6.2.4 → cachebox-6.2.6}/LICENSE +0 -0
  54. {cachebox-6.2.4 → cachebox-6.2.6}/LICENSE-THIRD-PARTY +0 -0
  55. {cachebox-6.2.4 → cachebox-6.2.6}/build.rs +0 -0
  56. {cachebox-6.2.4 → cachebox-6.2.6}/cachebox/__init__.py +0 -0
  57. {cachebox-6.2.4 → cachebox-6.2.6}/pyproject.toml +0 -0
  58. {cachebox-6.2.4 → cachebox-6.2.6}/rust-toolchain.toml +0 -0
  59. {cachebox-6.2.4 → cachebox-6.2.6}/rustfmt.toml +0 -0
  60. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/alloc.rs +0 -0
  61. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/control/bitmask.rs +0 -0
  62. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/control/group/generic.rs +0 -0
  63. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/control/group/lsx.rs +0 -0
  64. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/control/group/mod.rs +0 -0
  65. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/control/group/neon.rs +0 -0
  66. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/control/group/sse2.rs +0 -0
  67. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/control/mod.rs +0 -0
  68. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/control/tag.rs +0 -0
  69. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/mod.rs +0 -0
  70. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/raw.rs +0 -0
  71. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/scopeguard.rs +0 -0
  72. {cachebox-6.2.4 → cachebox-6.2.6}/src/hashbrown/util.rs +0 -0
  73. {cachebox-6.2.4 → cachebox-6.2.6}/src/internal/alias.rs +0 -0
  74. {cachebox-6.2.4 → cachebox-6.2.6}/src/internal/mod.rs +0 -0
  75. {cachebox-6.2.4 → cachebox-6.2.6}/src/internal/onceinit.rs +0 -0
  76. {cachebox-6.2.4 → cachebox-6.2.6}/src/internal/pickle.rs +0 -0
  77. {cachebox-6.2.4 → cachebox-6.2.6}/src/lib.rs +0 -0
  78. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/common.rs +0 -0
  79. {cachebox-6.2.4 → cachebox-6.2.6}/src/policies/mod.rs +0 -0
  80. {cachebox-6.2.4 → cachebox-6.2.6}/src/pyclasses/base.rs +0 -0
  81. {cachebox-6.2.4 → cachebox-6.2.6}/src/pyclasses/mod.rs +0 -0
  82. {cachebox-6.2.4 → cachebox-6.2.6}/src/typeref.rs +0 -0
  83. {cachebox-6.2.4 → cachebox-6.2.6}/tests/__init__.py +0 -0
  84. {cachebox-6.2.4 → cachebox-6.2.6}/tests/conftest.py +0 -0
  85. {cachebox-6.2.4 → cachebox-6.2.6}/tests/test_utils.py +0 -0
  86. {cachebox-6.2.4 → cachebox-6.2.6}/typos.toml +0 -0
  87. {cachebox-6.2.4 → cachebox-6.2.6}/uv.lock +0 -0
@@ -16,6 +16,7 @@ concurrency:
16
16
  env:
17
17
  (^_^): &interpreters "3.10 3.11 3.12 3.13 3.14 3.14t 3.15 3.15t pypy3.11"
18
18
  ○_○: &interpreters_without_pypy "3.10 3.11 3.12 3.13 3.14 3.14t 3.15 3.15t"
19
+ (o_o): &interpreters_win_arm64 "3.11 3.12 3.13 3.14 3.14t 3.15 3.15t"
19
20
 
20
21
  jobs:
21
22
  tools:
@@ -41,7 +42,7 @@ jobs:
41
42
  python-version: "3.14"
42
43
 
43
44
  - name: "Install uv"
44
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
45
+ uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
45
46
  with:
46
47
  # zizmor: ignore[cache-poisoning]
47
48
  enable-cache: ${{ github.event_name == 'pull_request' }}
@@ -127,12 +128,13 @@ jobs:
127
128
  path: dist
128
129
 
129
130
  build-windows:
130
- runs-on: windows-latest
131
+ runs-on: ${{ matrix.platform.runner }}
131
132
  strategy:
132
133
  matrix:
133
134
  platform:
134
- - { target: x64, interpreter: *interpreters }
135
- - { target: x86, interpreter: *interpreters_without_pypy }
135
+ - { runner: windows-latest, target: x64, arch: x64, interpreter: *interpreters }
136
+ - { runner: windows-latest, target: x86, arch: x86, interpreter: *interpreters_without_pypy }
137
+ - { runner: windows-11-arm, target: aarch64, arch: arm64, interpreter: *interpreters_win_arm64 }
136
138
 
137
139
  steps:
138
140
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -142,7 +144,7 @@ jobs:
142
144
  - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
143
145
  with:
144
146
  python-version: "3.x"
145
- architecture: ${{ matrix.platform.target }}
147
+ architecture: ${{ matrix.platform.arch }}
146
148
 
147
149
  - uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
148
150
  # zizmor: ignore[cache-poisoning]
@@ -20,7 +20,7 @@ jobs:
20
20
  python-version: 3.14
21
21
 
22
22
  - name: "Install uv"
23
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
23
+ uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
24
24
  with:
25
25
  enable-cache: false
26
26
 
@@ -40,7 +40,7 @@ jobs:
40
40
 
41
41
  - uses: dtolnay/rust-toolchain@stable # zizmor: ignore[unpinned-uses]
42
42
 
43
- - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
43
+ - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
44
44
  if: github.event_name == 'pull_request' && github.run_attempt == 1
45
45
  with:
46
46
  lookup-only: false # zizmor: ignore[cache-poisoning]
@@ -52,7 +52,7 @@ jobs:
52
52
  allow-prereleases: true
53
53
 
54
54
  - name: "Install uv"
55
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
55
+ uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
56
56
  with:
57
57
  enable-cache: false
58
58
 
@@ -93,7 +93,7 @@ jobs:
93
93
  python-version: "3.13"
94
94
 
95
95
  - name: "Install uv"
96
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
96
+ uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
97
97
  with:
98
98
  enable-cache: false
99
99
 
@@ -10,9 +10,9 @@ checksum = "c880a97d28a3681c0267bd29cff89621202715b065127cd445fa0f0fe0aa2880"
10
10
 
11
11
  [[package]]
12
12
  name = "android_system_properties"
13
- version = "0.1.5"
13
+ version = "0.1.6"
14
14
  source = "registry+https://github.com/rust-lang/crates.io-index"
15
- checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
15
+ checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc"
16
16
  dependencies = [
17
17
  "libc",
18
18
  ]
@@ -37,7 +37,7 @@ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
37
37
 
38
38
  [[package]]
39
39
  name = "cachebox"
40
- version = "6.2.4"
40
+ version = "6.2.6"
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.4.0"
53
+ version = "1.4.4"
54
54
  source = "registry+https://github.com/rust-lang/crates.io-index"
55
- checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9"
55
+ checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273"
56
56
  dependencies = [
57
57
  "find-msvc-tools",
58
58
  "shlex",
@@ -91,27 +91,27 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
91
91
 
92
92
  [[package]]
93
93
  name = "find-msvc-tools"
94
- version = "0.1.9"
94
+ version = "0.1.11"
95
95
  source = "registry+https://github.com/rust-lang/crates.io-index"
96
- checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
96
+ checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
97
97
 
98
98
  [[package]]
99
99
  name = "futures-core"
100
- version = "0.3.33"
100
+ version = "0.3.34"
101
101
  source = "registry+https://github.com/rust-lang/crates.io-index"
102
- checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7"
102
+ checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
103
103
 
104
104
  [[package]]
105
105
  name = "futures-task"
106
- version = "0.3.33"
106
+ version = "0.3.34"
107
107
  source = "registry+https://github.com/rust-lang/crates.io-index"
108
- checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109"
108
+ checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
109
109
 
110
110
  [[package]]
111
111
  name = "futures-util"
112
- version = "0.3.33"
112
+ version = "0.3.34"
113
113
  source = "registry+https://github.com/rust-lang/crates.io-index"
114
- checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa"
114
+ checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
115
115
  dependencies = [
116
116
  "futures-core",
117
117
  "futures-task",
@@ -151,9 +151,9 @@ dependencies = [
151
151
 
152
152
  [[package]]
153
153
  name = "js-sys"
154
- version = "0.3.103"
154
+ version = "0.3.104"
155
155
  source = "registry+https://github.com/rust-lang/crates.io-index"
156
- checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102"
156
+ checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a"
157
157
  dependencies = [
158
158
  "cfg-if",
159
159
  "futures-util",
@@ -177,9 +177,9 @@ dependencies = [
177
177
 
178
178
  [[package]]
179
179
  name = "log"
180
- version = "0.4.33"
180
+ version = "0.4.34"
181
181
  source = "registry+https://github.com/rust-lang/crates.io-index"
182
- checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
182
+ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
183
183
 
184
184
  [[package]]
185
185
  name = "num-traits"
@@ -227,9 +227,9 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
227
227
 
228
228
  [[package]]
229
229
  name = "portable-atomic"
230
- version = "1.14.0"
230
+ version = "1.15.0"
231
231
  source = "registry+https://github.com/rust-lang/crates.io-index"
232
- checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3"
232
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
233
233
 
234
234
  [[package]]
235
235
  name = "proc-macro2"
@@ -242,9 +242,9 @@ dependencies = [
242
242
 
243
243
  [[package]]
244
244
  name = "pyo3"
245
- version = "0.29.1"
245
+ version = "0.29.2"
246
246
  source = "registry+https://github.com/rust-lang/crates.io-index"
247
- checksum = "fc153f5fd745cc038b5eed86622125969f8a39834a57bc96beaaf2512b1da729"
247
+ checksum = "4688ddedf473e32662b9b067670129a8afb8c18e351482c70d62ba4a88171e8b"
248
248
  dependencies = [
249
249
  "chrono",
250
250
  "libc",
@@ -257,18 +257,18 @@ dependencies = [
257
257
 
258
258
  [[package]]
259
259
  name = "pyo3-build-config"
260
- version = "0.29.1"
260
+ version = "0.29.2"
261
261
  source = "registry+https://github.com/rust-lang/crates.io-index"
262
- checksum = "bb77d9aa6d647507b55c69ee714d266d84c526c78ff0bc6dd8757f58591e64d1"
262
+ checksum = "f41027e41b4bd03f6e60f9f417fe24a6341a6bb744edd62b6f709f2a52ea30e9"
263
263
  dependencies = [
264
264
  "target-lexicon",
265
265
  ]
266
266
 
267
267
  [[package]]
268
268
  name = "pyo3-ffi"
269
- version = "0.29.1"
269
+ version = "0.29.2"
270
270
  source = "registry+https://github.com/rust-lang/crates.io-index"
271
- checksum = "3160087aa5733bce7d9a729f8c55f85a2a53b74742a09613178eeebff0722253"
271
+ checksum = "e591a95526fead067432c3b3a33fc74770b87b1e04e73671090d9c2055a2b327"
272
272
  dependencies = [
273
273
  "libc",
274
274
  "pyo3-build-config",
@@ -276,9 +276,9 @@ dependencies = [
276
276
 
277
277
  [[package]]
278
278
  name = "pyo3-macros"
279
- version = "0.29.1"
279
+ version = "0.29.2"
280
280
  source = "registry+https://github.com/rust-lang/crates.io-index"
281
- checksum = "91f9d455db760a9a0b0ddeaac25f1390b8a36ba73dfbda9f127cac6fc340d4d5"
281
+ checksum = "73225868fc1cd84eef2c3c230ddb91273bf1de46aeb8a4248da76d32a0924a1c"
282
282
  dependencies = [
283
283
  "proc-macro2",
284
284
  "pyo3-macros-backend",
@@ -288,9 +288,9 @@ dependencies = [
288
288
 
289
289
  [[package]]
290
290
  name = "pyo3-macros-backend"
291
- version = "0.29.1"
291
+ version = "0.29.2"
292
292
  source = "registry+https://github.com/rust-lang/crates.io-index"
293
- checksum = "e343bcec300ff262f5806a33a4e51b6d097a8a46435f512fcb83e95592581625"
293
+ checksum = "571575aa3749fa6216757dd47d2a3e7ef360f329a40f0666a9fbd14889024952"
294
294
  dependencies = [
295
295
  "heck",
296
296
  "proc-macro2",
@@ -371,9 +371,9 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
371
371
 
372
372
  [[package]]
373
373
  name = "wasm-bindgen"
374
- version = "0.2.126"
374
+ version = "0.2.127"
375
375
  source = "registry+https://github.com/rust-lang/crates.io-index"
376
- checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4"
376
+ checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70"
377
377
  dependencies = [
378
378
  "cfg-if",
379
379
  "once_cell",
@@ -384,9 +384,9 @@ dependencies = [
384
384
 
385
385
  [[package]]
386
386
  name = "wasm-bindgen-macro"
387
- version = "0.2.126"
387
+ version = "0.2.127"
388
388
  source = "registry+https://github.com/rust-lang/crates.io-index"
389
- checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1"
389
+ checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1"
390
390
  dependencies = [
391
391
  "quote",
392
392
  "wasm-bindgen-macro-support",
@@ -394,9 +394,9 @@ dependencies = [
394
394
 
395
395
  [[package]]
396
396
  name = "wasm-bindgen-macro-support"
397
- version = "0.2.126"
397
+ version = "0.2.127"
398
398
  source = "registry+https://github.com/rust-lang/crates.io-index"
399
- checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e"
399
+ checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284"
400
400
  dependencies = [
401
401
  "bumpalo",
402
402
  "proc-macro2",
@@ -407,9 +407,9 @@ dependencies = [
407
407
 
408
408
  [[package]]
409
409
  name = "wasm-bindgen-shared"
410
- version = "0.2.126"
410
+ version = "0.2.127"
411
411
  source = "registry+https://github.com/rust-lang/crates.io-index"
412
- checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24"
412
+ checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"
413
413
  dependencies = [
414
414
  "unicode-ident",
415
415
  ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "cachebox"
3
- version = "6.2.4"
3
+ version = "6.2.6"
4
4
  edition = "2021"
5
5
  description = "The fastest memoizing and caching Python library written in Rust"
6
6
  readme = "README.md"
@@ -27,10 +27,10 @@ cfg-if = "1.0.4"
27
27
  chrono = "0.4.45"
28
28
  fastrand = "2.5.0"
29
29
  parking_lot = { version = "0.12.5", default-features = false }
30
- pyo3 = { version = "0.29.1", default-features = false, features = ["macros", "chrono"] }
30
+ pyo3 = { version = "0.29.2", default-features = false, features = ["macros", "chrono"] }
31
31
 
32
32
  [build-dependencies]
33
- pyo3-build-config = { version = "0.29.1", default-features = false, features = ["resolve-config"] }
33
+ pyo3-build-config = { version = "0.29.2", default-features = false, features = ["resolve-config"] }
34
34
 
35
35
  [features]
36
36
  default = ["inline-more", "extension-module"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cachebox
3
- Version: 6.2.4
3
+ Version: 6.2.6
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python
6
6
  Classifier: Programming Language :: Python :: 3
@@ -47,9 +47,9 @@ _The fastest caching Python library written in Rust_
47
47
  [![Monthly Downloads](https://shieldcn.dev/pypi/dm/cachebox.svg?variant=branded&font=geist-mono&size=xs)](https://pypi.org/project/cachebox)
48
48
  [![Python Version](https://shieldcn.dev/pypi/python/cachebox.svg?variant=branded&font=geist-mono&size=xs)](https://pypi.org/project/cachebox)
49
49
 
50
- [![CI](https://shieldcn.dev/github/ci/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&animate=pulse)](https://github.com/awolverp/cachebox/actions?query=branch%3Amain)
51
- [![Last Commit](https://shieldcn.dev/github/last-commit/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs)](https://github.com/awolverp/cachebox/commits/main)
52
- [![License](https://shieldcn.dev/github/awolverp/cachebox/license.svg?variant=outline&font=geist-mono&size=xs)](https://github.com/awolverp/cachebox/blob/main/LICENSE)
50
+ <a href="https://github.com/awolverp/cachebox/actions?query=branch%3Amain"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/ci/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&animate=pulse&mode=dark"><img alt="CI" src="https://shieldcn.dev/github/ci/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&animate=pulse&mode=light"></picture></a>
51
+ <a href="https://github.com/awolverp/cachebox/commits/main"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/last-commit/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&mode=dark"><img alt="Last Commit" src="https://shieldcn.dev/github/last-commit/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&mode=light"></picture></a>
52
+ <a href="https://github.com/awolverp/cachebox/blob/main/LICENSE"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/awolverp/cachebox/license.svg?variant=outline&font=geist-mono&size=xs&mode=dark"><img alt="License" src="https://shieldcn.dev/github/awolverp/cachebox/license.svg?variant=outline&font=geist-mono&size=xs&mode=light"></picture></a>
53
53
 
54
54
  </div>
55
55
 
@@ -184,7 +184,9 @@ Read the documentation for full information and learn more: [**Documentation**](
184
184
 
185
185
  ## Contributors
186
186
 
187
- [![Contributers](https://contrib.rocks/image?repo=awolverp/cachebox)](https://github.com/awolverp/cachebox/graphs/contributors)
187
+ <p align="center">
188
+ <a href="https://github.com/awolverp/cachebox/graphs/contributors"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/contributors/awolverp/cachebox.svg?title=false&amp;preset=transparent&amp;size=80&amp;names=true&amp;titleAlign=center&amp;mode=dark" /><img alt="contributors" src="https://shieldcn.dev/contributors/awolverp/cachebox.svg?title=false&amp;preset=transparent&amp;size=80&amp;names=true&amp;titleAlign=center&amp;mode=light" /></picture></a>
189
+ </p>
188
190
 
189
191
  ## License
190
192
 
@@ -11,9 +11,9 @@ _The fastest caching Python library written in Rust_
11
11
  [![Monthly Downloads](https://shieldcn.dev/pypi/dm/cachebox.svg?variant=branded&font=geist-mono&size=xs)](https://pypi.org/project/cachebox)
12
12
  [![Python Version](https://shieldcn.dev/pypi/python/cachebox.svg?variant=branded&font=geist-mono&size=xs)](https://pypi.org/project/cachebox)
13
13
 
14
- [![CI](https://shieldcn.dev/github/ci/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&animate=pulse)](https://github.com/awolverp/cachebox/actions?query=branch%3Amain)
15
- [![Last Commit](https://shieldcn.dev/github/last-commit/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs)](https://github.com/awolverp/cachebox/commits/main)
16
- [![License](https://shieldcn.dev/github/awolverp/cachebox/license.svg?variant=outline&font=geist-mono&size=xs)](https://github.com/awolverp/cachebox/blob/main/LICENSE)
14
+ <a href="https://github.com/awolverp/cachebox/actions?query=branch%3Amain"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/ci/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&animate=pulse&mode=dark"><img alt="CI" src="https://shieldcn.dev/github/ci/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&animate=pulse&mode=light"></picture></a>
15
+ <a href="https://github.com/awolverp/cachebox/commits/main"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/last-commit/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&mode=dark"><img alt="Last Commit" src="https://shieldcn.dev/github/last-commit/awolverp/cachebox.svg?variant=outline&font=geist-mono&size=xs&mode=light"></picture></a>
16
+ <a href="https://github.com/awolverp/cachebox/blob/main/LICENSE"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/awolverp/cachebox/license.svg?variant=outline&font=geist-mono&size=xs&mode=dark"><img alt="License" src="https://shieldcn.dev/github/awolverp/cachebox/license.svg?variant=outline&font=geist-mono&size=xs&mode=light"></picture></a>
17
17
 
18
18
  </div>
19
19
 
@@ -148,7 +148,9 @@ Read the documentation for full information and learn more: [**Documentation**](
148
148
 
149
149
  ## Contributors
150
150
 
151
- [![Contributers](https://contrib.rocks/image?repo=awolverp/cachebox)](https://github.com/awolverp/cachebox/graphs/contributors)
151
+ <p align="center">
152
+ <a href="https://github.com/awolverp/cachebox/graphs/contributors"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/contributors/awolverp/cachebox.svg?title=false&amp;preset=transparent&amp;size=80&amp;names=true&amp;titleAlign=center&amp;mode=dark" /><img alt="contributors" src="https://shieldcn.dev/contributors/awolverp/cachebox.svg?title=false&amp;preset=transparent&amp;size=80&amp;names=true&amp;titleAlign=center&amp;mode=light" /></picture></a>
153
+ </p>
152
154
 
153
155
  ## License
154
156
 
@@ -161,16 +161,15 @@ class TTLCache(_CoreTTLCache[KT, VT]):
161
161
  )
162
162
 
163
163
  self._thread: threading.Thread | None = None
164
- self._thread_is_running: bool = False
164
+ self._stop_event = threading.Event()
165
165
 
166
166
  if sweep_interval is not None:
167
167
  if isinstance(sweep_interval, timedelta):
168
168
  sweep_interval = sweep_interval.total_seconds()
169
169
 
170
170
  if sweep_interval < 1:
171
- raise ValueError("sweep_interval must be more than 1 seconds.")
171
+ raise ValueError("sweep_interval must be at least 1 second.")
172
172
 
173
- self._thread_is_running = True
174
173
  self._thread = threading.Thread(
175
174
  target=self._sweeper_thread,
176
175
  args=(sweep_interval,),
@@ -185,17 +184,19 @@ class TTLCache(_CoreTTLCache[KT, VT]):
185
184
  """The configured ``sweep_interval`` in seconds."""
186
185
  return self._sweep_interval
187
186
 
188
- def _sweeper_thread(self, interval: float):
189
- while self._thread_is_running:
190
- time.sleep(interval)
187
+ def _sweeper_thread(self, interval: float) -> None:
188
+ while not self._stop_event.wait(interval):
191
189
  self.expire()
192
190
 
193
191
  def stop_sweeper(self) -> None:
194
192
  """Signals the background sweeper thread to stop, if one is active."""
195
- self._thread_is_running = False
193
+ self._stop_event.set()
196
194
 
197
195
  def __del__(self) -> None:
198
- self.stop_sweeper()
196
+ # If super().__init__ raises for any reason (bad arguments, type error, ...),
197
+ # the assignment to self._stop_event never happens.
198
+ if hasattr(self, "_stop_event"):
199
+ self.stop_sweeper()
199
200
 
200
201
 
201
202
  class VTTLCache(_CoreVTTLCache[KT, VT]):
@@ -333,16 +334,15 @@ class VTTLCache(_CoreVTTLCache[KT, VT]):
333
334
  )
334
335
 
335
336
  self._thread: threading.Thread | None = None
336
- self._thread_is_running: bool = False
337
+ self._stop_event = threading.Event()
337
338
 
338
339
  if sweep_interval is not None:
339
340
  if isinstance(sweep_interval, timedelta):
340
341
  sweep_interval = sweep_interval.total_seconds()
341
342
 
342
343
  if sweep_interval < 1:
343
- raise ValueError("sweep_interval must be more than 1 seconds.")
344
+ raise ValueError("sweep_interval must be at least 1 second.")
344
345
 
345
- self._thread_is_running = True
346
346
  self._thread = threading.Thread(
347
347
  target=self._sweeper_thread,
348
348
  args=(sweep_interval,),
@@ -357,14 +357,16 @@ class VTTLCache(_CoreVTTLCache[KT, VT]):
357
357
  """The configured ``sweep_interval`` in seconds."""
358
358
  return self._sweep_interval
359
359
 
360
- def _sweeper_thread(self, interval: float):
361
- while self._thread_is_running:
362
- time.sleep(interval)
360
+ def _sweeper_thread(self, interval: float) -> None:
361
+ while not self._stop_event.wait(interval):
363
362
  self.expire()
364
363
 
365
364
  def stop_sweeper(self) -> None:
366
365
  """Signals the background sweeper thread to stop, if one is active."""
367
- self._thread_is_running = False
366
+ self._stop_event.set()
368
367
 
369
368
  def __del__(self) -> None:
370
- self.stop_sweeper()
369
+ # If super().__init__ raises for any reason (bad arguments, type error, ...),
370
+ # the assignment to self._stop_event never happens.
371
+ if hasattr(self, "_stop_event"):
372
+ self.stop_sweeper()