Cache.MemoryIn-memory HTTP response cache using a Hashtbl. Thread-safe using Eio.Mutex.
val create : ?max_entries:int -> unit -> tCreate a new in-memory cache.
val store :
t ->
url:string ->
method_:Method.t ->
status:int ->
headers:Headers.t ->
body:string ->
request_time:Ptime.t ->
response_time:Ptime.t ->
?request_headers:Headers.t ->
unit ->
boolStore a response in the cache. Returns true if stored, false if not cacheable.
val lookup :
t ->
method_:Method.t ->
uri:string ->
?request_headers:Headers.t ->
now:Ptime.t ->
unit ->
(entry * lookup_status) optionLook up a cached response.
val invalidate : t -> uri:string -> unitRemove all entries for a URI (used after unsafe methods).
val clear : t -> unitClear all entries from the cache.
val size : t -> intReturn the number of entries in the cache.
val stats : t -> int * int * intReturn cache statistics: (hits, misses, stores).