Commits

Alexey Kishkin committed 59608a7

converted comments to ocamldoc format

  • Participants
  • Parent commits 3d44a43

Comments (0)

Files changed (1)

  Memcached Client library module (binary protocol)                   
                                                                      
  @author Alexey Kishkin odobenus-rosmarus@ya.ru                      
-
+ @version 1.0
 
  This file is part of omcbp.
  
 
 **********************************************************************)
 
-(* Low level operations *)
+(** Low level operations *)
 type operation =
    | Get
    | Set
    | AppendQ
    | PrependQ;;
 
-(* packet header *)
+(** packet header *)
 type magic = Request | Response;;
 
+(** Response from memcache server*)
 type response_status =
       MC_No_error
    | MC_Key_not_found
    Int64.logor (Int64.logor (Int64.logor b1 b2) (Int64.logor b3 b4)) (Int64.logor (Int64.logor b5 b6) (Int64.logor b7 b8));;
 
 
-(* Main class for binary protocol
-  Parameters:
-    host - string - address of memcache server 
-    port - integer - internet port 
+(** Main class for memcache connection
+    @param  host - string -ip address or hostname of memcache server 
+    @param  port - integer - internet port 
  *)
 
 class memcache_connector (host: string) (port: int) =
       let (key, extras, value) = self#decode_body body keylength extralength total_body_length in
       (status, op, key, value, extras, opaque, cas)
    
-   (* Set cache data.
-   Params:
+   (** Set cache data.
    
-     key  - string 
-     value - string 
-     flags - integer - 
-     expiration - integer - seconds to invalidation this record
+     @param key  - string 
+     @param value - string 
+     @param flags - integer - 
+     @param expiration - integer - seconds to invalidation this record
    *)
    method set key v flags expiration =
       let buf = Buffer.create 8 in
          (status, ky, value)
       end
 
-   (* Set 'quietly' (don't wait for answer) cache data.
-   Params:
+   (** Set 'quietly' (don't wait for answer) cache data.
    
-     key  - string 
-     value - string 
-     flags - integer - 
-     expiration - integer - seconds to invalidation this record
+     @param key  - string 
+     @param value - string 
+     @param flags - integer - 
+     @param expiration - integer - seconds to invalidation this record
    *)
    
    method setq key v flags expiration =
          flush o_channel
       end
   
-  (* Add (operation fails if key already exists) cache data.
-   Params:
+  (** Add (operation fails if key already exists) cache data.
    
-     key  - string 
-     value - string 
-     flags - integer - 
-     expiration - integer - seconds to invalidation this record
+     @param key  string 
+     @param value  string 
+     @param flags  integer - 
+     @param expiration  integer - seconds to invalidation this record
+     
+     @return (status key value)
    *)
 
    
          (status, ky, value)
       end
 
-  (* Add (operation fails if key already exists) cache data. Dont wait the answer.
-   Params:
+  (** Add (operation fails if key already exists) cache data. Dont wait the answer.
    
-     key  - string 
-     value - string 
-     flags - integer - 
-     expiration - integer - seconds to invalidation this record
+     @param key  - string 
+     @param value - string 
+     @param flags - integer - 
+     @param expiration - integer - seconds to invalidation this record
    *)
    
    method addq key v flags expiration =
       end
       
       
-  (* replace (operation fails if key doesnt exist) cache data.
-   Params:
+  (** Replace (operation fails if key doesnt exist) cache data.
    
-     key  - string 
-     value - string 
-     flags - integer - 
-     expiration - integer - seconds to invalidation this record
+     @param key  - string 
+     @param value - string 
+     @param flags - integer - 
+     @param expiration - integer - seconds to invalidation this record
    *)
-      
-   
    method replace key v flags expiration =
       let buf = Buffer.create 8 in
       let _ = set_i32 buf flags and _ = set_i32 buf expiration in
          (status, key, value)
       end
    
- (* replace quietly (dont wait answer)  cache data. Ooperation fails if key doesn't exist
-   Params:
+ (** Replace quietly (dont wait answer)  cache data. Ooperation fails if key doesn't exist
    
-     key  - string 
-     value - string 
-     flags - integer - 
-     expiration - integer - seconds to invalidation this record
+     @param key  - string 
+     @param value - string 
+     @param flags - integer - 
+     @param expiration - integer - seconds to invalidation this record
    *)
- 
    method replaceq key v flags expiration =
       let buf = Buffer.create 8 in
       let _ = set_i32 buf flags and _ = set_i32 buf expiration in
          flush o_channel;
       end
  
-   (* Delete key *)
+   (** Delete key *)
    
    method delete key =
       let cargo = self#encode_packet Delete key "" "" 0 0L in
          (status, key, value)
       end
    
-   (* Delete key , dont wait the answer *)
+   (** Delete key , dont wait the answer  *)
    
    method deleteq key =
       let cargo = self#encode_packet DeleteQ key "" "" 0 0L in
          flush o_channel;
       end
    
-   (* Retrieve key
-   Param  
-      key - string
-   returns:
-      (status, key, value)
-      Key and value -- strings,  Status is 'response_status" type 
+   (** Retrieve key
+      @param key - string
+      @return  (status, key, value)  Key and value -- strings,  Status is 'response_status" type 
     *)
    method get key =
       let cargo = self#encode_packet GetK key "" "" 0 0L in
       end
 
 
-   (* Retrieve  a lot of records at once
-   Param  
-      keys - list of string
-   returns:
-      list of (status, key, value)
-      Key and value -- strings,  Status is 'response_status" type 
+   (** Retrieve  a lot of records at once
+      @param keys - list of string
+      @return  list of (status, key, value),    Key and value -- strings,  Status is 'response_status" type 
     *)
    
    method multiget keys =
          !answers
       end
 
-  (* Increment value in the cache
-   Param  
-      key - string
-      value_to_add int64
-      initial_value int64
-      expiration - time in seconds to invalidation
-   returns:
-      (status, key, value)
-      Key and value -- strings,  Status is 'response_status" type 
+  (** Increment value in the cache
+      @param key - string
+      @param value_to_add int64
+      @param initial_value int64
+      @param expiration - time in seconds to invalidation
+      
+      @return  (status, key, value)  Key and value -- strings,  Status is 'response_status" type 
     *)
-   
    method incr key (value_to_add: int64) (initial_value: int64) expiration =
       let buf = Buffer.create 20 in
       let _ = set_int64 buf value_to_add
 
 
 
-  (* Increment value in the cache, dont wait for answer
-   Param  
-      key - string
-      value_to_add int64
-      initial_value int64
-      expiration - time in seconds to invalidation
+  (** Increment value in the cache, dont wait for answer
+      @param key - string
+      @param value_to_add int64
+      @param initial_value int64
+      @param expiration - time in seconds to invalidation
     *)
-   
    method incrq key (value_to_add: int64) (initial_value: int64) expiration =
       let buf = Buffer.create 20 in
       let _ = set_int64 buf value_to_add
       end
 
       
-   (* Decrement valie in the cache 
-   Param  
-      key - string
-      value_to_add int64
-      initial_value int64
-      expiration - time in seconds to invalidation
-   returns:
-      (status, key, value)
-      Key and value -- strings,  Status is 'response_status" type 
+   (** Decrement valie in the cache 
+      @param key - string
+      @param value_to_add int64
+      @param initial_value int64
+      @param expiration - time in seconds to invalidation
+      @return (status, key, value)  Key and value -- strings,  Status is 'response_status" type 
     *)
    method decr key (value_to_sub: int64) (initial_value: int64) expiration =
       let buf = Buffer.create 20 in
          let (status, op, key, value, extras, opaque, cas) = self#read_answer in
          (status, key, (get_int64 value 0))
       end
-   (* The same but dont wait for answer *)
+      
+   (** The same but dont wait for answer *)
    method decrq key (value_to_sub: int64) (initial_value: int64) expiration =
       let buf = Buffer.create 20 in
       let _ = set_int64 buf value_to_sub
          flush o_channel;
       end
   
-  (* Close connection *) 
+  (** Close connection 
+      @return (status, key, value)  Key and value -- strings (must be ignored),  Status is 'response_status" type 
+  *) 
    method quit =
       let cargo = self#encode_packet Quit "" "" "" 0 0L in
       begin
          (status, key, value)
       end
 
-  (* Close connection, dont wait for answer *) 
+  (** Close connection, dont wait for answer *) 
    method quitq =
       let cargo = self#encode_packet QuitQ "" "" "" 0 0L in
       begin