接口 CacheCreator
- 所有已知实现类:
AbstractCacheCreator,RedisCacheCreator
-
字段概要
字段 -
方法概要
修饰符和类型方法说明<K,V> Cache<K, V> createForObject(org.babyfish.jimmer.meta.ImmutableType type) <K,V> Cache<K, V> createForProp(org.babyfish.jimmer.meta.ImmutableProp prop, boolean multiView) default @NotNull CacheCreatorwithHardLock(@Nullable CacheLocker locker, @Nullable Duration leaseDuration) default @NotNull CacheCreatorwithLocalCache(int maxSize) @NotNull CacheCreatorwithLocalCache(int maxSize, @Nullable Duration duration) default @NotNull CacheCreatorwithLocalCache(Duration duration) @NotNull CacheCreatorwithLock(@Nullable CacheLocker locker, @Nullable Duration waitDuration, @Nullable Duration leaseDuration) default @NotNull CacheCreatorwithMultiViewProperties(@Nullable Integer localMaximumSize, @Nullable Duration localDuration) @NotNull CacheCreatorwithMultiViewProperties(@Nullable Integer localMaximumSize, @Nullable Duration localDuration, @Nullable Duration remoteDuration) default @NotNull CacheCreatordefault @NotNull CacheCreatordefault @NotNull CacheCreatordefault @NotNull CacheCreatorwithRemoteDuration(@Nullable Duration duration) Set L2 cache expiration time.@NotNull CacheCreatorwithRemoteDuration(@Nullable Duration duration, int randomPercent) Set L2 cache expiration time.default @NotNull CacheCreatorwithSoftLock(@Nullable CacheLocker locker, @Nullable Duration leaseDuration) @NotNull CacheCreatorwithTracking(@Nullable CacheTracker tracker)
-
字段详细资料
-
DEFAULT_REMOTE_DURATION
-
DEFAULT_REMOTE_DURATION_RANDOM_PERCENT
static final int DEFAULT_REMOTE_DURATION_RANDOM_PERCENT- 另请参阅:
-
DEFAULT_LOCAL_CACHE_MAX_SIZE
static final int DEFAULT_LOCAL_CACHE_MAX_SIZE- 另请参阅:
-
DEFAULT_LOCAL_DURATION
-
-
方法详细资料
-
withRemoteDuration
@NewChain @NotNull default @NotNull CacheCreator withRemoteDuration(@Nullable @Nullable Duration duration) Set L2 cache expiration time.This method does not modify the current object, but creates a new object.
Note: This method is equivalent to
withRemoteDuration(duration, 30)- 参数:
duration- The expiration time- 返回:
- The created new object
-
withRemoteDuration
@NewChain @NotNull @NotNull CacheCreator withRemoteDuration(@Nullable @Nullable Duration duration, int randomPercent) Set L2 cache expiration time.This method does not modify the current object, but creates a new object.
- 参数:
duration- The expiration timerandomPercent- A random percentBatch loading is a frequently used optimization method in jimmer, so a batch of values are often put into the cache at the same time. If the expiration time of these cached data is the same, then in the future, some affected data will be discarded by the cache at the same time so that a big hole will appear in the defense of the cache, which is easy to be penetrated.
To solve this problem, Jimmer supports a random factor that modifies the expiration time and then applies it to the L2 cache, ultimately making the expiration time of the data uneven.
- 返回:
- The created new object
-
withLocalCache
-
withLocalCache
-
withLocalCache
@NewChain @NotNull @NotNull CacheCreator withLocalCache(int maxSize, @Nullable @Nullable Duration duration) -
withoutLocalCache
-
withLock
@NewChain @NotNull @NotNull CacheCreator withLock(@Nullable @Nullable CacheLocker locker, @Nullable @Nullable Duration waitDuration, @Nullable @Nullable Duration leaseDuration) -
withHardLock
@NewChain @NotNull default @NotNull CacheCreator withHardLock(@Nullable @Nullable CacheLocker locker, @Nullable @Nullable Duration leaseDuration) -
withSoftLock
@NewChain @NotNull default @NotNull CacheCreator withSoftLock(@Nullable @Nullable CacheLocker locker, @Nullable @Nullable Duration leaseDuration) -
withoutLock
-
withTracking
-
withoutTracking
-
withMultiViewProperties
@NewChain @NotNull default @NotNull CacheCreator withMultiViewProperties(@Nullable @Nullable Integer localMaximumSize, @Nullable @Nullable Duration localDuration) -
withMultiViewProperties
@NewChain @NotNull @NotNull CacheCreator withMultiViewProperties(@Nullable @Nullable Integer localMaximumSize, @Nullable @Nullable Duration localDuration, @Nullable @Nullable Duration remoteDuration) -
createForObject
-
createForProp
-