Package org.casbin.jcasbin.persist.cache
Interface Cache
- All Known Implementing Classes:
DefaultCache
public interface Cache
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear deletes all items stored in the cache.void
Delete removes the specific key from the cache.boolean
Get returns the result for the given key.boolean
Set puts key and value into cache.
-
Method Details
-
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.- Parameters:
key
- the key to storevalue
- the value to storeextra
- additional parameters (e.g., expiration time)- Returns:
- true if successful, false otherwise
-
get
Get returns the result for the given key. If there's no such key in the cache, Optional.empty() will be returned.- Parameters:
key
- the key to retrieve- Returns:
- an Optional containing the boolean value if present, otherwise Optional.empty()
-
delete
Delete removes the specific key from the cache. If the key doesn't exist, it returns false.- Parameters:
key
- the key to delete
-
clear
void clear()Clear deletes all items stored in the cache.
-