@Override
    public boolean add(V value) {
        lock.lock();
        
        try {
            checkComparator();
    
            BinarySearchResult<V> res = binarySearch(value);
            int index = 0;
            if (res.getIndex() < 0) {
                index = -(res.getIndex() + 1);
            } else {
                index = res.getIndex() + 1;
            }
                
            get(commandExecutor.evalWriteNoRetryAsync(getRawName(), codec, RedisCommands.EVAL_VOID,
               "local len = redis.call('llen', KEYS[1]);"
                + "if tonumber(ARGV[1]) < len then "
                    + "local pivot = redis.call('lindex', KEYS[1], ARGV[1]);"
                    + "redis.call('linsert', KEYS[1], 'before', pivot, ARGV[2]);"
                    + "return;"
                + "end;"
                + "redis.call('rpush', KEYS[1], ARGV[2]);", 
                    Arrays.asList(getRawName()),
                    index, encode(value)));
            return true;
        } finally {
            lock.unlock();
        }
    }
@Test
    public void testDuplicates() {
        RPriorityQueue<TestObject> set = redisson.getPriorityQueue("set");

        set.add(new TestObject("1", "2"));
        set.add(new TestObject("2", "3"));
        set.add(new TestObject("5", "6"));
        set.add(new TestObject("1", "2"));
        set.add(new TestObject("3", "4"));

        Assertions.assertEquals(5, set.size());
        
        assertThat(set).containsExactly(new TestObject("1", "2"), new TestObject("1", "2"),
                new TestObject("2", "3"), new TestObject("3", "4"), new TestObject("5", "6"));
    }