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 Tget(@NotNull String key)Retrieve the object stored under thekey.voidput(@NotNull String key, T value)Put the object in the cache with the givenkey.voidput(@NotNull String key, T value, @NotNull Duration duration)Put the object in the cache with the givenkeyfor the givenduration.voidput(@NotNull String key, T value, @NotNull LocalDateTime expiresAt)Put the object in the cache with the givenkeyfor untilexpiresAthas come.voidput(@NotNull String key, T value, @NotNull ZonedDateTime expiresAt)Put the object in the cache with the givenkeyfor untilexpiresAthas come.voidremove(@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 givenkeyfor 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 givenkeyfor untilexpiresAthas come.The object is stored and should be removed when
expiresAthad come.
-
put
public void put(@NotNull @NotNull String key, @NotNull T value, @NotNull @NotNull ZonedDateTime expiresAt)Put the object in the cache with the givenkeyfor untilexpiresAthas come.The object is stored and should be removed when
expiresAthad come.
-
-