Package com.jms.socialmedia.cache
Class RedisCachingService
- java.lang.Object
-
- com.jms.socialmedia.cache.AbstractCachingService
-
- com.jms.socialmedia.cache.AbstractCodecCachingService<String>
-
- com.jms.socialmedia.cache.RedisCachingService
-
public class RedisCachingService extends AbstractCodecCachingService<String>
-
-
Constructor Summary
Constructors Constructor Description RedisCachingService(CachingCodec<String> cachingServiceCodec, String host, int port)
RedisCachingService(CachingCodec<String> cachingServiceCodec, String host, int port, int expireTimeInSeconds)
RedisCachingService(CachingCodec<String> cachingServiceCodec, redis.clients.jedis.JedisPool jedisPool)
RedisCachingService(CachingCodec<String> cachingServiceCodec, redis.clients.jedis.JedisPoolConfig jedisPoolConfig, String host, int port)
RedisCachingService(CachingCodec<String> cachingServiceCodec, redis.clients.jedis.JedisPoolConfig jedisPoolConfig, String host, int port, int expireTimeInSeconds)
RedisCachingService(CachingCodec<String> cachingServiceCodec, redis.clients.jedis.JedisPool jedisPool, int expireTimeInSeconds)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getEncodedCommentFromCache(int commentId)
protected Collection<String>
getEncodedCommentsFromCache(int postId)
protected String
getEncodedPostFromCache(int postId)
protected String
getEncodedUserSessionFromCache(String sessionKey)
protected void
invalidateComment(int commentId)
protected void
invalidatePost(int postId)
Slightly different fromAbstractCachingService.removePostFromCache(int)
This one only removes thePost
, not all theComment
s of the Postprotected void
putEncodedCommentIntoCache(int commentId, int postId, String encodedComment)
protected void
putEncodedCommentsFromPostIntoCache(int postId, Map<String,Double> encodedCommentsWithId)
protected void
putEncodedPostIntoCache(int postId, String encodedPost)
protected void
putEncodedUserSessionIntoCache(String sessionKey, String encodedUserSession)
void
removeCommentFromCache(int commentId)
void
removePostFromCache(int postId)
void
removeUserSessionFromCache(String sessionKey)
-
Methods inherited from class com.jms.socialmedia.cache.AbstractCodecCachingService
editCommentInCache, editPostInCache, getCommentFromCache, getCommentsFromCache, getPostFromCache, getUserSessionFromCache, likeCommentInCache, likePostInCache, putCommentIntoCache, putCommentsFromPostIntoCache, putPostIntoCache, putUserSessionIntoCache, unlikeCommentInCache, unlikePostInCache
-
Methods inherited from class com.jms.socialmedia.cache.AbstractCachingService
commentsCacheHit, commentsCacheMiss, getCommentsFromCacheOrSupplier, getPostFromCacheOrSupplier, getUserSessionCacheOrSupplier, postCacheHit, postCacheMiss, userSessionCacheHit, userSessionCacheMiss
-
-
-
-
Constructor Detail
-
RedisCachingService
public RedisCachingService(CachingCodec<String> cachingServiceCodec, String host, int port, int expireTimeInSeconds)
-
RedisCachingService
public RedisCachingService(CachingCodec<String> cachingServiceCodec, String host, int port)
-
RedisCachingService
public RedisCachingService(CachingCodec<String> cachingServiceCodec, redis.clients.jedis.JedisPoolConfig jedisPoolConfig, String host, int port)
-
RedisCachingService
public RedisCachingService(CachingCodec<String> cachingServiceCodec, redis.clients.jedis.JedisPoolConfig jedisPoolConfig, String host, int port, int expireTimeInSeconds)
-
RedisCachingService
public RedisCachingService(CachingCodec<String> cachingServiceCodec, redis.clients.jedis.JedisPool jedisPool)
-
RedisCachingService
public RedisCachingService(CachingCodec<String> cachingServiceCodec, redis.clients.jedis.JedisPool jedisPool, int expireTimeInSeconds)
-
-
Method Detail
-
getEncodedPostFromCache
protected String getEncodedPostFromCache(int postId)
- Specified by:
getEncodedPostFromCache
in classAbstractCodecCachingService<String>
-
putEncodedPostIntoCache
protected void putEncodedPostIntoCache(int postId, String encodedPost)
- Specified by:
putEncodedPostIntoCache
in classAbstractCodecCachingService<String>
-
removePostFromCache
public void removePostFromCache(int postId)
Description copied from class:AbstractCachingService
- Specified by:
removePostFromCache
in classAbstractCachingService
-
invalidatePost
protected void invalidatePost(int postId)
Description copied from class:AbstractCodecCachingService
Slightly different fromAbstractCachingService.removePostFromCache(int)
This one only removes thePost
, not all theComment
s of the Post- Specified by:
invalidatePost
in classAbstractCodecCachingService<String>
-
getEncodedCommentsFromCache
protected Collection<String> getEncodedCommentsFromCache(int postId)
- Specified by:
getEncodedCommentsFromCache
in classAbstractCodecCachingService<String>
-
getEncodedCommentFromCache
protected String getEncodedCommentFromCache(int commentId)
- Specified by:
getEncodedCommentFromCache
in classAbstractCodecCachingService<String>
-
putEncodedCommentsFromPostIntoCache
protected void putEncodedCommentsFromPostIntoCache(int postId, Map<String,Double> encodedCommentsWithId)
- Specified by:
putEncodedCommentsFromPostIntoCache
in classAbstractCodecCachingService<String>
-
putEncodedCommentIntoCache
protected void putEncodedCommentIntoCache(int commentId, int postId, String encodedComment)
- Specified by:
putEncodedCommentIntoCache
in classAbstractCodecCachingService<String>
-
removeCommentFromCache
public void removeCommentFromCache(int commentId)
- Specified by:
removeCommentFromCache
in classAbstractCachingService
-
invalidateComment
protected void invalidateComment(int commentId)
- Specified by:
invalidateComment
in classAbstractCodecCachingService<String>
-
getEncodedUserSessionFromCache
protected String getEncodedUserSessionFromCache(String sessionKey)
- Specified by:
getEncodedUserSessionFromCache
in classAbstractCodecCachingService<String>
-
putEncodedUserSessionIntoCache
protected void putEncodedUserSessionIntoCache(String sessionKey, String encodedUserSession)
- Specified by:
putEncodedUserSessionIntoCache
in classAbstractCodecCachingService<String>
-
removeUserSessionFromCache
public void removeUserSessionFromCache(String sessionKey)
- Specified by:
removeUserSessionFromCache
in classAbstractCachingService
-
-