public static void main(String[] args) throws Exception {
        String props="udp.xml";
        boolean migrate_data=false;

        for(int i=0; i < args.length; i++) {
            if(args[i].equals("-props")) {
                props=args[++i];
                continue;
            }
            if(args[i].equals("-migrate_data")) {
                migrate_data=true;
                continue;
            }
            help();
            return;
        }



        PartitionedHashMap<String,String> map=new PartitionedHashMap<>(props, "demo-cluster");
        Cache<String,String> l1_cache=new Cache<>();
        l1_cache.setMaxNumberOfEntries(5);
        l1_cache.disableReaping();
        map.setL1Cache(l1_cache);
        Cache<String, String> l2_cache=map.getL2Cache();
        l2_cache.enableReaping(10000);
        map.setMigrateData(migrate_data);
        map.start();

        while(true) {
            int ch=Util.keyPress("[1] put [2] get [3] remove [4] print [q] quit");

            switch(ch) {
                case '1':
                    String key=readLine("key: ");
                    String val=readLine("val: ");
                    String caching_time=readLine("ttl: ");
                    map.put(key, val, Long.parseLong(caching_time));
                    break;
                case '2':
                    key=readLine("key: ");
                    val=map.get(key);
                    System.out.println("val = " + val);
                    break;
                case '3':
                    key=readLine("key: ");
                    map.remove(key);
                    break;
                case '4':
                    System.out.println("address: " + map.getLocalAddress());
                    System.out.println("L1 cache:\n" + map.getL1Cache());
                    System.out.println("L2 cache:\n" + map.getL2Cache());
                    break;
                case 'q':
                    l1_cache.stop();
                    map.stop();
                    return;
            }
        }

    }