sig
type key = [ `Hash of Digest.t | `String of string ]
type timestamp = int64
type entry =
Cache_aux.entry = {
mutable e_key : Digest.t;
mutable e_creation : Cache_client.timestamp;
mutable e_modification : Cache_client.timestamp;
mutable e_expiration : Cache_client.timestamp;
mutable e_delete_flag : bool;
mutable e_value : string;
mutable e_value_hash : Digest.t;
mutable e_value_length : int;
mutable e_counter : int;
mutable e_bucket : int;
}
type set_options =
Cache_aux.set_options = {
mutable opt_overwrite : bool;
mutable opt_add : bool;
mutable opt_undelete : bool;
mutable opt_setifchanged : bool;
}
type get_options =
Cache_aux.get_options = {
mutable opt_novalue : bool;
mutable opt_getifmodifiedsince : Cache_client.timestamp option;
mutable opt_getifnotmd5 : Digest.t option;
}
type delete_options =
Cache_aux.delete_options = {
mutable opt_strictlock : bool;
mutable opt_delifolderthan : Cache_client.timestamp option;
mutable opt_delifmd5 : Digest.t option;
mutable opt_delifnotmd5 : Digest.t option;
}
type config =
Cache_aux.config = {
mutable max_size : int64;
mutable save_cache_period : int;
mutable save_cache_speed : int;
}
type stats =
Cache_aux.stats = {
mutable num_entries : int;
mutable num_bytes : int64;
mutable num_calls_get : int;
mutable num_calls_set : int;
mutable num_calls_delete : int;
mutable num_hits : int;
mutable counters_reset_on : Cache_client.timestamp;
}
type 'a async_reply = (unit -> 'a) -> unit
exception Server_not_alive
class type client_config =
object
method buckets : Rpc_client.connector array
method idle_timeout : float
method is_alive : int -> bool
method query_timeout : float
end
class type async_client =
object
method clear : [ `Ok | `Timeout ] Cache_client.async_reply -> unit
method clear_counters :
[ `Ok | `Timeout ] Cache_client.async_reply -> unit
method client_config : Cache_client.client_config
method delete :
[ `Ok | `Timeout ] Cache_client.async_reply ->
Cache_client.key ->
Cache_client.timestamp -> Cache_client.delete_options -> unit
method get :
[ `Found of Cache_client.entry | `Not_found | `Timeout ]
Cache_client.async_reply ->
Cache_client.key -> Cache_client.get_options -> unit
method get_config :
[ `Ok of (Rpc_client.connector * Cache_client.config) list | `Timeout ]
Cache_client.async_reply -> unit
method get_stats :
[ `Ok of (Rpc_client.connector * Cache_client.stats) list | `Timeout ]
Cache_client.async_reply -> unit
method set :
[ `Not_stored | `Stored | `Timeout ] Cache_client.async_reply ->
Cache_client.key ->
string -> Cache_client.timestamp -> Cache_client.set_options -> unit
method set_config :
[ `Ok | `Timeout ] Cache_client.async_reply ->
(Rpc_client.connector * Cache_client.config) list -> unit
method shutdown : unit -> unit
end
class type sync_client =
object
method clear : unit -> [ `Ok | `Timeout ]
method clear_counters : unit -> [ `Ok | `Timeout ]
method client_config : Cache_client.client_config
method delete :
Cache_client.key ->
int64 -> Cache_client.delete_options -> [ `Ok | `Timeout ]
method get :
Cache_client.key ->
Cache_client.get_options ->
[ `Found of Cache_client.entry | `Not_found | `Timeout ]
method get_config :
unit ->
[ `Ok of (Rpc_client.connector * Cache_client.config) list | `Timeout ]
method get_stats :
unit ->
[ `Ok of (Rpc_client.connector * Cache_client.stats) list | `Timeout ]
method set :
Cache_client.key ->
string ->
int64 ->
Cache_client.set_options -> [ `Not_stored | `Stored | `Timeout ]
method set_config :
(Rpc_client.connector * Cache_client.config) list ->
[ `Ok | `Timeout ]
method shutdown : unit -> unit
end
val create_async_client :
Cache_client.client_config ->
Unixqueue.event_system -> Cache_client.async_client
val create_sync_client :
Cache_client.client_config -> Cache_client.sync_client
end