Class RedisInterceptor
- java.lang.Object
-
- org.elypia.retropia.extensions.redis.RedisInterceptor
-
- All Implemented Interfaces:
okhttp3.Interceptor
public class RedisInterceptor extends Object implements okhttp3.Interceptor
-
-
Constructor Summary
Constructors Constructor Description RedisInterceptor(redis.clients.jedis.Jedis jedis, int ttl)RedisInterceptor(redis.clients.jedis.JedisShardInfo info, int ttl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description okhttp3.ResponseafterResponse(okhttp3.Request request, okhttp3.Response response)okhttp3.ResponsebeforeRequest(okhttp3.Request request)Check Redis if it has cached a response for this request already.redis.clients.jedis.JedisgetJedis()okhttp3.Responseintercept(okhttp3.Interceptor.Chain chain)
-
-
-
Method Detail
-
intercept
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException- Specified by:
interceptin interfaceokhttp3.Interceptor- Throws:
IOException
-
beforeRequest
public okhttp3.Response beforeRequest(okhttp3.Request request) throws IOExceptionCheck Redis if it has cached a response for this request already. Does nothing for non-GET requests.- Parameters:
request- The request that was executed.- Returns:
- The response if a response is applicable.
- Throws:
IOException
-
afterResponse
public okhttp3.Response afterResponse(okhttp3.Request request, okhttp3.Response response) throws IOException- Throws:
IOException
-
getJedis
public redis.clients.jedis.Jedis getJedis()
-
-