package tcpip
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=6e32bf540d291e9b7325cb3dd00df2f695533e009c46ea534d5518b9492c7348
sha512=2e9f9ca2eeac637599eb48e087b4632598539f1c76f9251758995c7eedeb723f8b951d557a2a53b85a58d50a04e68e15598581f88fca8997733e800fcfca422b
doc/tcpip.ipv4/Fragments/Cache/index.html
Module Fragments.CacheSource
include Lru.F.S with type k = K.t and type v = V.t
Functional LRU map
A map.
Limiting the weight of bindings
capacity t is the maximum combined weight of bindings that trim will retain.
resize cap t sets t's capacity to cap, while leaving the bindings unchanged.
trim t is t', where weight t' <= capacity t'.
This is achieved by discarding bindings in LRU-to-MRU order.
Access by k
promote k t is t with the binding for k promoted to most-recently-used, or t if k is not bound in t.
add k v t adds the binding k -> v to t as the most-recently-used binding.
Note add does not remove bindings. To ensure that the resulting map is not over capacity, compose with trim.
pop k t is (v, t'), where v is the value bound to k, and t' is t without the binding k -> t, or None if k is not bound in t.
Access to least-recently-used bindings
lru t is the least-recently-used binding in t, or None, when t is empty.
pop_lru t is ((k, v), t', where (k, v) is lru t, and t' is t without that binding.
Aggregate access
fold f z t is f k0 v0 (... (f kn vn z)), where k0 -> v0 is LRU and kn -> vn is MRU.
fold_k f z t folds in key-increasing order, ignoring the recently-used ordering.
Note fold_k is faster than fold.
iter f t applies f to all the bindings in t in in LRU-to-MRU order.
iter_k f t applies f in key-increasing order, ignoring the recently-used ordering.
Note iter_k is faster than iter.
Conversions
Pretty-printing
val pp :
?pp_size:(Format.formatter -> (int * int) -> unit) ->
?sep:(Format.formatter -> unit -> unit) ->
(Format.formatter -> (k * v) -> unit) ->
Format.formatter ->
t ->
unit