java.lang.Object
org.miaixz.bus.pager.cache.SimpleCache<K,V>
- Type Parameters:
K- the type of keys maintained by this cacheV- the type of mapped values
- All Implemented Interfaces:
org.miaixz.bus.cache.CacheX<K,V>
Simple MyBatis Cache implementation that wraps an
Cache instance. This class allows
configuring the underlying MyBatis cache using properties.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleCache(Properties properties) Constructs a new SimpleCache with the given properties. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all entries from the cache.read(Collection<K> keys) Reads multiple values from the cache associated with the given keys.Reads a value from the cache associated with the given key.voidRemoves the specified keys from the cache.voidWrites multiple key-value pairs to the cache with a specified expiration time.voidWrites a key-value pair to the cache with a specified expiration time.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.cache.CacheX
containsKey, write
-
Constructor Details
-
SimpleCache
Constructs a new SimpleCache with the given properties. The properties are used to configure the underlying MyBatis cache, including its type, eviction policy, and size.- Parameters:
properties- the properties for configuring the cache
-
-
Method Details
-
read
Reads a value from the cache associated with the given key. -
read
Reads multiple values from the cache associated with the given keys. This implementation returns an empty map as it's not directly supported by the underlying MyBatis cache. -
write
Writes a key-value pair to the cache with a specified expiration time. The expiration time is not directly used by the underlying MyBatis cache, which is configured via properties. -
write
Writes multiple key-value pairs to the cache with a specified expiration time. This implementation does nothing as it's not directly supported by the underlying MyBatis cache. -
remove
Removes the specified keys from the cache. This implementation does nothing as it's not directly supported by the underlying MyBatis cache. -
clear
public void clear()Clears all entries from the cache. This implementation does nothing as it's not directly supported by the underlying MyBatis cache.
-