small-cache 0.0.2__tar.gz → 0.0.4__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.
@@ -14,7 +14,7 @@ jobs:
14
14
  python-version: ["3.11", "3.12"]
15
15
 
16
16
  steps:
17
- - uses: actions/checkout@v5
17
+ - uses: actions/checkout@v6
18
18
 
19
19
  - uses: actions/setup-python@v6
20
20
  with:
@@ -11,7 +11,7 @@ jobs:
11
11
  name: Build SDist
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: actions/checkout@v5
14
+ - uses: actions/checkout@v6
15
15
  with:
16
16
  submodules: true
17
17
 
@@ -36,11 +36,11 @@ jobs:
36
36
  os: [ubuntu-latest, macos-latest, windows-latest]
37
37
 
38
38
  steps:
39
- - uses: actions/checkout@v5
39
+ - uses: actions/checkout@v6
40
40
  with:
41
41
  submodules: true
42
42
 
43
- - uses: pypa/cibuildwheel@v3.2
43
+ - uses: pypa/cibuildwheel@v3.3
44
44
 
45
45
  - name: Verify clean directory
46
46
  run: git diff --exit-code
@@ -66,7 +66,7 @@ include(FetchContent)
66
66
  FetchContent_Declare(
67
67
  glaze
68
68
  GIT_REPOSITORY https://github.com/stephenberry/glaze.git
69
- GIT_TAG main
69
+ GIT_TAG v6.1.0
70
70
  GIT_SHALLOW TRUE
71
71
  )
72
72
 
@@ -75,7 +75,7 @@ FetchContent_MakeAvailable(glaze)
75
75
  FetchContent_Declare(
76
76
  tsl_sparse_map
77
77
  GIT_REPOSITORY https://github.com/Tessil/sparse-map
78
- GIT_TAG master
78
+ GIT_TAG v0.7.0
79
79
  GIT_SHALLOW TRUE
80
80
  )
81
81
  FetchContent_MakeAvailable(tsl_sparse_map)
@@ -83,7 +83,7 @@ FetchContent_MakeAvailable(tsl_sparse_map)
83
83
  FetchContent_Declare(
84
84
  absl
85
85
  GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
86
- GIT_TAG master
86
+ GIT_TAG 20250814.1
87
87
  GIT_SHALLOW TRUE
88
88
  OVERRIDE_FIND_PACKAGE TRUE
89
89
  EXCLUDE_FROM_ALL
@@ -99,7 +99,7 @@ Set(FETCHCONTENT_QUIET FALSE)
99
99
  FetchContent_Declare(
100
100
  Boost
101
101
  URL https://github.com/boostorg/boost/releases/download/boost-1.88.0/boost-1.88.0-cmake.7z
102
- GIT_TAG "boost-1.88.0"
102
+ GIT_TAG "boost-1.89.0"
103
103
  USES_TERMINAL_DOWNLOAD TRUE
104
104
  GIT_PROGRESS TRUE
105
105
  DOWNLOAD_NO_EXTRACT FALSE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: small-cache
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Small cache
5
5
  Author: kam1k4dze
6
6
  Classifier: License :: OSI Approved :: BSD License
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["scikit-build-core >=0.10", "nanobind >=1.3.2"]
2
+ requires = ["scikit-build-core >=0.10", "nanobind ==2.9.2"]
3
3
  build-backend = "scikit_build_core.build"
4
4
 
5
5
  [project]
6
6
  name = "small-cache"
7
- version = "0.0.2"
7
+ version = "0.0.4"
8
8
  description = "Small cache"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -295,7 +295,7 @@ public:
295
295
  increaseIteratorVersion();
296
296
  }
297
297
 
298
- std::vector<pyAttrValue> get(const str &id, const strVec &attributes) {
298
+ std::vector<pyAttrValue> get_one(const str &id, const strVec &attributes) {
299
299
  if (attributes.empty()) {
300
300
  return {};
301
301
  }
@@ -316,6 +316,14 @@ public:
316
316
  return {};
317
317
  }
318
318
 
319
+ std::vector<std::vector<pyAttrValue>> get_many(const strVec &ids, const strVec &attributes) {
320
+ std::vector<std::vector<pyAttrValue>> out;
321
+ out.resize(ids.size());
322
+ for (size_t i = 0; i < ids.size(); ++i) {
323
+ out[i] = get_one(ids[i], attributes);
324
+ }
325
+ return out;
326
+ }
319
327
 
320
328
  struct getAllResponse {
321
329
  uint64_t iterator_version{};
@@ -345,7 +353,7 @@ public:
345
353
  auto i = iterator;
346
354
  while (i < iterator + per_iteration && i < keys.size()) {
347
355
  const auto &key = keys[i];
348
- resp.result.emplace_back(key, get(key, attributes));
356
+ resp.result.emplace_back(key, get_one(key, attributes));
349
357
  i++;
350
358
  }
351
359
  resp.iterator_version = this->iterator_version;
@@ -378,8 +386,7 @@ public:
378
386
  } else {
379
387
  if (transactionShouldRemoveOldItems) {
380
388
  it = cache.erase(it);
381
- }
382
- else {
389
+ } else {
383
390
  ++it;
384
391
  }
385
392
  }
@@ -434,10 +441,11 @@ NB_MODULE(_small_cache_impl, m) {
434
441
  nb::arg("remove_old_items") = true)
435
442
  .def("end_transaction", &SmallCache::end_transaction)
436
443
  .def("add", &SmallCache::add_item, nb::arg("item_id"), nb::arg("attributes"))
437
- .def("get", &SmallCache::get, nb::arg("id"), nb::arg("attributes"))
444
+ .def("get_one", &SmallCache::get_one, nb::arg("id"), nb::arg("attributes"))
445
+ .def("get_many", &SmallCache::get_many, nb::arg("ids"), nb::arg("attributes"))
438
446
  .def("get_all", &SmallCache::get_all, nb::arg("attributes"), nb::arg("per_iteration") = 10000,
439
- nb::arg("iterator_version") = 0,
440
- nb::arg("iterator") = 0)
447
+ nb::arg("iterator_version") = 0,
448
+ nb::arg("iterator") = 0)
441
449
  .def("load_page", &SmallCache::load_page, nb::arg("json_text"));
442
450
  // nb::class_<SmallCache::getAllResponse>(cache, "getAllResponse")
443
451
  // .def(nb::init<>())
File without changes
File without changes