-
Notifications
You must be signed in to change notification settings - Fork 2
/
memcached.mli
153 lines (133 loc) · 2.43 KB
/
memcached.mli
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
open Core.Std
open Async.Std
module type S = sig
type t
type value
type opcode =
Get
| Set
| Add
| Replace
| Delete
| Increment
| Decrement
| Quit
| Flush
| GetQ
| NoOp
| Version
| GetK
| GetKQ
| Append
| Prepend
| Stat
| SetQ
| AddQ
| ReplaceQ
| DeleteQ
| IncrementQ
| DecrementQ
| QuitQ
| FlushQ
| AppendQ
| PrependQ
type status =
NoError
| KeyNotFound
| KeyExists
| ValueTooLarge
| InvalidArguments
| ItemNotStored
| IncrDecrOnNonNumericValue
| UnknownCommand
| OutOfMemory
type data_type = RawBytes
type response = {
opcode : opcode;
key_length : int;
extras_length : int;
data_type : data_type;
status : status;
total_body_length : int32;
opaque : string;
cas : string;
extras : string;
key : string;
value : string;
}
val connect : host:string -> port:int -> t Deferred.t
val command :
?data_type:data_type ->
?opaque:Int32.t ->
?cas:Int64.t ->
?value:value option ->
?extras:string option ->
?key:string option ->
t ->
opcode:opcode ->
response Deferred.Or_error.t
val get :
t ->
key:string ->
value Deferred.Or_error.t
val set :
?flags:Int32.t ->
?expiry:Int32.t ->
t ->
key:string ->
value:value ->
bool Deferred.Or_error.t
val add :
?flags:Int32.t ->
?expiry:Int32.t ->
t ->
key:string ->
value:value ->
bool Deferred.Or_error.t
val replace :
?flags:Int32.t ->
?expiry:Int32.t ->
t ->
key:string ->
value:value ->
bool Deferred.Or_error.t
val delete :
t ->
key:string ->
bool Deferred.Or_error.t
val incr :
?expiry:int32 ->
t ->
key:string ->
initial:int64 ->
delta:int64 ->
int64 Deferred.Or_error.t
val decr :
?expiry:int32 ->
t ->
key:string ->
initial:int64 ->
delta:int64 ->
int64 Deferred.Or_error.t
val prepend :
t ->
key:string ->
value:value ->
bool Deferred.Or_error.t
val append :
t ->
key:string ->
value:value ->
bool Deferred.Or_error.t
val flush :
?expiry:int32 ->
t ->
bool Deferred.Or_error.t
val close : t -> unit Deferred.t
end
module type Value = sig
type t
val to_string: t -> string
val of_string: string -> t
end
module Make (Value : Value) : S with type value = Value.t