public Operation createStore(String cmd, String key, Object value,
                                          Date expiry) {

        if (cmd == null) {
            throw new NullPointerException("cmd not must be  null !");
        }

        if (expiry == null)
            expiry = new Date(0);

        int expiryTime = (int) (expiry.getTime() / 1000);

        if (MemcachedConstants.CMD_ADD.equals(cmd)) {

            Operation operation = new AddOperation(key, value, expiryTime);
            operation.setMemcachedNode(getAvailableMemcachedNode(key));

            return operation;
        } else if (MemcachedConstants.CMD_SET.equals(cmd)) {

            Operation operation = new SetOperation(key, value, expiryTime);
            operation.setMemcachedNode(getAvailableMemcachedNode(key));
            return operation;

        } else if (MemcachedConstants.CMD_REPLACE.equals(cmd)) {
            Operation operation = new ReplaceOperation(key, value, expiryTime);
            operation.setMemcachedNode(getAvailableMemcachedNode(key));

            return operation;
        } else if (MemcachedConstants.CMD_APPEND.equals(cmd)) {
            Operation operation = new AppendOperation(key, value, expiryTime);
            operation.setMemcachedNode(getAvailableMemcachedNode(key));

            return operation;
        } else {
            throw new IllegalArgumentException(
                    "Cmd may be 'add' , 'append' 'set' or 'replace' ");
        }
    }