Class JedisUtils
java.lang.Object
org.deltava.util.JedisUtils
A utility class for Redis operations.
- Since:
- 6.1
- Version:
- 11.3
- Author:
- Luke
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Deletes keys from Redis.static byte[]
Returns a key's encoding in UTF-8.static Object
Fetches an object from Redis.static redis.clients.jedis.Jedis
Obtains a connection from the Jedis connection pool.Returns the Redis server and connection pool status.static void
init
(org.gvagroup.pool.ConnectionPool<redis.clients.jedis.Jedis> pool) Injects the Jedis connection pool.static Collection
<String> Returns all keys matching a particular pattern.static void
Pushes a value to a list.static Object
read
(byte[] data) Deserializes an object and swallows exceptions.static byte[]
Helper method to serialiaze an object and swallow checked exceptions.static void
Writes an object to Redis.
-
Field Details
-
LATENCY_KEY
-
-
Method Details
-
init
public static void init(org.gvagroup.pool.ConnectionPool<redis.clients.jedis.Jedis> pool) Injects the Jedis connection pool.- Parameters:
pool
- the pool
-
getConnection
Obtains a connection from the Jedis connection pool. This exists forJedisCache
, and is ugly- Returns:
- a Jedis connection
- Throws:
Exception
- if the connection pool is full or not yet loaded
-
encodeKey
Returns a key's encoding in UTF-8.- Parameters:
key
- the key- Returns:
- the key using the standard encoding
-
read
Deserializes an object and swallows exceptions.- Parameters:
data
- the raw data- Returns:
- the deserialized data
-
write
Helper method to serialiaze an object and swallow checked exceptions.- Parameters:
o
- the Object to serialize- Returns:
- the serialized data
-
get
-
write
-
push
-
delete
-
keys
Returns all keys matching a particular pattern.- Parameters:
pattern
- the key pattern- Returns:
- a Collection of keys
-
getStatus
-