Class DefaultCache
java.lang.Object
org.casbin.jcasbin.persist.cache.DefaultCache
- All Implemented Interfaces:
Cache
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the entire cache.voidDelete the value from the cache.booleanGet the value from the cache, handling expiration.voidSet the cache value without a TTL.booleanSet puts key and value into cache.voidSet the cache value with an optional time-to-live (TTL).
-
Field Details
-
cache
-
-
Constructor Details
-
DefaultCache
public DefaultCache()
-
-
Method Details
-
set
Set the cache value with an optional time-to-live (TTL).- Parameters:
key- The cache key to store the value.value- The boolean value to be stored in the cache.ttl- The time-to-live for the cache item; if null or negative, the item will not expire.
-
set
Set the cache value without a TTL.- Parameters:
key- The cache key to store the value.value- The boolean value to be stored in the cache.
-
set
Set puts key and value into cache. The first extra parameter should be a java.time.LocalDateTime object denoting the expected survival time. If survival time equals 0 or less, the key will always be valid. -
get
Get the value from the cache, handling expiration.- Specified by:
getin interfaceCache- Parameters:
key- The cache key to retrieve the value.- Returns:
- The value corresponding to the key.
- Throws:
CasbinCacheException- If the key does not exist in the cache.
-
delete
Delete the value from the cache.- Specified by:
deletein interfaceCache- Parameters:
key- The cache key to delete the value.- Throws:
CasbinCacheException
-
clear
-