View raw

1 (** A bounded key-value cache with first-in-first-out eviction. 2 3 Keys are strings; values are whatever the instance stores. Callers build 4 keys from content identifiers (a repository head hash, for example), so a 5 key's value never changes — adding a key that is already present is 6 therefore a no-op. *) 7 8 type 'a t 9 10 val create : capacity:int -> 'a t 11 (** An empty cache holding at most [capacity] entries. *) 12 13 val find : 'a t -> string -> 'a option 14 15 val add : 'a t -> string -> 'a -> unit 16 (** Insert a value, evicting the oldest entry when the cache is full. A no-op 17 when the key is already present. *) 18