package resource_cache

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file config.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module Stable = struct
  open! Core_kernel.Core_kernel_stable

  module V2 = struct
    type t =
      { max_resources : int
      ; idle_cleanup_after : Time_ns.Span.V2.t
      ; max_resources_per_id : int
      ; max_resource_reuse : int
      ; close_idle_resources_when_at_limit : bool
      }
    [@@deriving bin_io, sexp]

    let%expect_test _ =
      print_endline [%bin_digest: t];
      [%expect {| 0b4e2e81e7d6313c18730c4807c9d69f |}]
    ;;
  end

  module V1 = struct
    type t =
      { max_resources : int
      ; idle_cleanup_after : Time_ns.Span.V2.t
      ; max_resources_per_id : int
      ; max_resource_reuse : int
      }
    [@@deriving
      bin_io
    , sexp
    , stable_record ~version:V2.t ~add:[ close_idle_resources_when_at_limit ]]

    let to_v2 = to_V2_t ~close_idle_resources_when_at_limit:false

    let%expect_test _ =
      print_endline [%bin_digest: t];
      [%expect {| 32e8b51732879423c8392f29f3265d27 |}]
    ;;
  end
end

open! Core_kernel
open! Async_kernel
open! Import

type t = Stable.V2.t =
  { max_resources : int
  ; idle_cleanup_after : Time_ns.Span.t
  ; max_resources_per_id : int
  ; max_resource_reuse : int
  ; close_idle_resources_when_at_limit : bool
  }
[@@deriving compare, fields, sexp_of]

let create = Fields.create