Common methods

Each Redisson object implements RObject and RExpirable interfaces.

Usage example:

RObject object = redisson.get...()

object.sizeInMemory();

object.delete();

object.rename("newname");

object.isExists();

// listening to expired events
object.addListener((ExpiredObjectListener) name -> {

   //...

});

// listening to delete events
object.addListener((DeletedObjectListener) name -> {

   //...

});

Name of Redisson object is a key in Redis or Valkey.

RMap map = redisson.getMap("mymap");
map.getName(); // = mymap

Global operations over keys are exposed by RKeys interface. Usage example:

RKeys keys = redisson.getKeys();

Iterable<String> allKeys = keys.getKeys();

Iterable<String> foundedKeys = keys.getKeysByPattern('key*');

long numOfDeletedKeys = keys.delete("obj1", "obj2", "obj3");

long deletedKeysAmount = keys.deleteByPattern("test?");

String randomKey = keys.randomKey();

long keysAmount = keys.count();

keys.flushall();

keys.flushdb();
Global listeners are executed for all Redisson objects. Available listeners: TrackingListener, SetObjectListener, NewObjectListener, ExpiredObjectListener, DeletedObjectListener, FlushListener

Usage example:

int id = redisson.getKeys().addListener((NewObjectListener) name -> {

   //...

});

int id = redisson.getKeys().addListener((DeletedObjectListener) name -> {

   //...

});

int id = r.getKeys().addListener((FlushListener) address -> {

   //...

});