@@ -570,6 +570,31 @@ PYBIND11_MODULE(_libcachesim, m) { // NOLINT(readability-named-parameter)
570570 Cache: A new TwoQ cache instance.
571571 )pbdoc" );
572572
573+ // S4FIFO
574+ m.def (
575+ " S4FIFO_init" ,
576+ [](uint64_t cache_size, double small_size_ratio, double ghost_size_ratio, int move_to_main_threshold, double small_skip_ratio) {
577+ common_cache_params_t cc_params = {.cache_size = cache_size};
578+ cache_t * ptr = S4FIFO_init (cc_params, (" small-size-ratio=" + std::to_string (small_size_ratio) + " ," +
579+ " ghost-size-ratio=" + std::to_string (ghost_size_ratio) + " ," +
580+ " move-to-main-threshold=" + std::to_string (move_to_main_threshold) + " ," +
581+ " small-skip-ratio=" + std::to_string (small_skip_ratio))
582+ .c_str ());
583+ return std::unique_ptr<cache_t , CacheDeleter>(ptr);
584+ },
585+ py::arg (" cache_size" ), py::arg (" small_size_ratio" ) = 0.10 ,
586+ py::arg (" ghost_size_ratio" ) = 0.90 , py::arg (" move_to_main_threshold" ) = 2 ,
587+ py::arg (" small_skip_ratio" ) = 0 ,
588+ R"pbdoc(
589+ Create a S4FIFO cache instance.
590+
591+ Args:
592+ cache_size (int): Size of the cache in bytes.
593+ small_size_ratio (float): Ratio of small size to cache size (default: 0.10).
594+ ghost_size_ratio (float): Ratio of ghost size to cache size (default: 0.90).
595+ move_to_main_threshold (int): Threshold for moving to main queue (default: 2).
596+ )pbdoc" );
597+
573598#ifdef VERSION_INFO
574599 m.attr (" __version__" ) = MACRO_STRINGIFY (VERSION_INFO);
575600#else
0 commit comments