Package org.hawaiiframework.cache.redis
Class RedisCache<T>
- java.lang.Object
-
- org.hawaiiframework.cache.redis.RedisCache<T>
-
-
Constructor Summary
Constructors Constructor Description RedisCache(org.springframework.data.redis.core.RedisTemplate<String,T> redisTemplate, HawaiiTime hawaiiTime, Long defaultExpireInMinutes, String keyPrefix)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get(@NotNull String key)
Retrieve the object stored under thekey
.void
put(@NotNull String key, T value)
Put the object in the cache with the givenkey
.void
put(@NotNull String key, T value, @NotNull Duration duration)
Put the object in the cache with the givenkey
for the givenduration
.void
put(@NotNull String key, T value, @NotNull LocalDateTime expiresAt)
Put the object in the cache with the givenkey
for untilexpiresAt
has come.void
put(@NotNull String key, T value, @NotNull ZonedDateTime expiresAt)
Put the object in the cache with the givenkey
for untilexpiresAt
has come.void
remove(@NotNull String key)
Remove the value associate with thekey
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hawaiiframework.cache.Cache
optional, putEternally
-
-
-
-
Constructor Detail
-
RedisCache
public RedisCache(org.springframework.data.redis.core.RedisTemplate<String,T> redisTemplate, HawaiiTime hawaiiTime, Long defaultExpireInMinutes, String keyPrefix)
Constructor.- Parameters:
redisTemplate
- The redis template to use.hawaiiTime
- the Hawaii time, used to get the current time.defaultExpireInMinutes
- The default time out in minutes.keyPrefix
- They key's prefix.
-
-
Method Detail
-
put
public void put(@NotNull @NotNull String key, @NotNull T value)
Put the object in the cache with the givenkey
.The object is stored for the default configured time, depending on the cache implementation. See general remarks about cache evictions.
-
put
public void put(@NotNull @NotNull String key, @NotNull T value, @NotNull @NotNull Duration duration)
Put the object in the cache with the givenkey
for the givenduration
.The object is stored for the requested duration. See general remarks about cache evictions.
-
put
public void put(@NotNull @NotNull String key, @NotNull T value, @NotNull @NotNull LocalDateTime expiresAt)
Put the object in the cache with the givenkey
for untilexpiresAt
has come.The object is stored and should be removed when
expiresAt
had come.
-
put
public void put(@NotNull @NotNull String key, @NotNull T value, @NotNull @NotNull ZonedDateTime expiresAt)
Put the object in the cache with the givenkey
for untilexpiresAt
has come.The object is stored and should be removed when
expiresAt
had come.
-
-