-
Notifications
You must be signed in to change notification settings - Fork 0
RedisManager
RedisManager
is a utility class for managing connections to a Redis server and performing various operations on lists, sets, keys, and values in that server.
- Overview
- Constructor
- List Operations
- Set Operations
- Key-Value Operations
- Byte Array Operations
- Examples
RedisManager
leverages the Jedis
library to interact with a Redis server, providing a simplified and concise interface for performing common Redis operations.
Connects to the specified Redis server using given connection parameters.
Pushes a value onto a list.
Gets a range of elements from a list.
Removes the first count occurrences of elements equal to value from the list.
Adds a member to a set.
Removes and returns a random member from a set.
Checks if a member is part of a set.
Gets the value of the specified key.
Sets the specified key to the specified value.
Deletes one or more keys.
Pushes a byte array onto a list.
Adds a byte array to a set.
Sets the specified key to the specified byte array.
RedisManager manager = new RedisManager("localhost", "6379", "password");
manager.lpush("myList", "value");
List<String> values = manager.lrange("myList", 0, -1);
manager.sadd("mySet", "value");
String value = manager.get("key");
byte[] byteArray = "value".getBytes(StandardCharsets.UTF_8);
manager.lpush("myList", byteArray);
These examples showcase how to use RedisManager
to perform various Redis operations.