1

I am using redisson library for java to maintain RLO (redisson live objects) for storing nested objects. I used delete to remove those nested objects from the redis but from the redis-cli I see that in fact the object was deleted partially. what am I missing?

1 Answers1

1

I have also crossed paths with the issue of incomplete deletions but I believe that it is due to there being two different delete methods that differ in their behavior.

    /**
     * Deletes attached object including all nested objects.
     *
     * @param <T> Entity type
     * @param attachedObject - proxied object
     */
    <T> void delete(T attachedObject);

    /**
     * Deletes object by class and ids including all nested objects.
     *
     * @param <T> Entity type
     * @param entityClass - object class
     * @param ids - object ids
     * 
     * @return amount of deleted objects
     */
    <T> long delete(Class<T> entityClass, Object... ids);

Although both say they will delete all nested objects, only one of them carries this out. The first method will, in fact, call the private method

    private <T> void delete(T attachedObject, Set<String> deleted)

which will carry out the deletion of nested objects as can be seen after a quick inspection:

        for (Entry<String, Object> obj : getMap(attachedObject).entrySet())

I don't know if this is a bug.

Just use the other method for the time being. If you have the entity ID then it would be easy to just run a get and then a delete on the returned live object.

hanzo2001
  • 1,338
  • 1
  • 10
  • 24