#!/usr/bin/env python

import sys
import argparse
import client_wrap

WRITE_FUNCTIONS = {
    'double' : client_wrap.ClientWrap.WriteDouble,
    'long' : client_wrap.ClientWrap.WriteLong,
    'string' : client_wrap.ClientWrap.WriteString
}

def parse_args():
    parser = argparse.ArgumentParser(description="This is utility to set new value for the specified key in the cache")
    parser.add_argument("-t", "--type", help="type of the cached data", default="double", choices=('double', 'long', 'string'))
    parser.add_argument("-c", "--connection", help="connection string", default="ipc:///var/run/zero-cache/0")
    parser.add_argument("-k", "--key", help="key string", required=True)
    parser.add_argument("-v", "--value", help="cached value", required=True)
    parser.add_argument("-l", "--log", help="log file name", default="")

    global ARGS
    ARGS = parser.parse_args()

def write_value(client, key, value):
    return WRITE_FUNCTIONS[ARGS.type](client, key, value)

def main():
    parse_args()
    client = client_wrap.ClientWrap(ARGS.log, ARGS.connection, 0)
    write_value(client, ARGS.key, ARGS.value)

if __name__ == "__main__":
    main()

@@ -50,27 +50,26 @@
 %0Aimport 
-client_wrap
+zero_cache
 %0A%0AWRITE_
@@ -97,38 +97,33 @@
 uble' : 
-client_wrap
+zero_cache
 .Client
-Wrap
 .WriteDo
@@ -141,38 +141,33 @@
 long' : 
-client_wrap
+zero_cache
 .Client
-Wrap
 .WriteLo
@@ -172,59 +172,75 @@
 Long
-,%0A    'string' : client_wrap.ClientWrap.WriteString
+%0A%7D%0A%0ACONVERSION_FUNCTIONS = %7B%0A    'double' : float,%0A    'long' : int
 %0A%7D%0A%0A
@@ -358,19 +358,21 @@
 ecified 
-key
+index
  in the 
@@ -498,18 +498,8 @@
 ong'
-, 'string'
 ))%0A 
@@ -527,149 +527,52 @@
 t(%22-
-c
+i
 %22, %22--
-connection%22, help=%22connection string%22, default=%22ipc:///var/run/zero-cache/0%22)%0A    parser.add_argument(%22-k%22, %22--key%22, help=%22key string%22
+index%22, help=%22index number%22, type=int
 , re
@@ -799,35 +799,37 @@
 e_value(client, 
-key
+index
 , value):%0A    re
@@ -868,19 +868,21 @@
 client, 
-key
+index
 , value)
@@ -929,30 +929,25 @@
 t = 
-client_wrap
+zero_cache
 .Client
-Wrap
 (ARG
@@ -955,28 +955,64 @@
 .log
-, ARGS.connection, 0
+)%0A    value = CONVERSION_FUNCTIONS%5BARGS.type%5D(ARGS.value
 )%0A  
@@ -1042,18 +1042,15 @@
 RGS.
-key, ARGS.
+index, 
 valu

Fix `zc-set` utility according new zero-cache 2.0 API