47
47
public class RedisCacheConfiguration {
48
48
49
49
protected static final boolean DEFAULT_CACHE_NULL_VALUES = true ;
50
- protected static final boolean DEFAULT_ENABLE_TTI_EXPIRATION = false ;
50
+ protected static final boolean DEFAULT_ENABLE_TIME_TO_IDLE_EXPIRATION = false ;
51
51
protected static final boolean DEFAULT_USE_PREFIX = true ;
52
52
protected static final boolean DO_NOT_CACHE_NULL_VALUES = false ;
53
53
protected static final boolean DO_NOT_USE_PREFIX = false ;
54
- protected static final boolean ENABLE_IDLE_TIME_EXPIRATION = true ;
54
+ protected static final boolean USE_TIME_TO_IDLE_EXPIRATION = true ;
55
55
56
56
/**
57
57
* Default {@link RedisCacheConfiguration} using the following:
@@ -112,7 +112,7 @@ public static RedisCacheConfiguration defaultCacheConfig(@Nullable ClassLoader c
112
112
113
113
return new RedisCacheConfiguration (TtlFunction .persistent (),
114
114
DEFAULT_CACHE_NULL_VALUES ,
115
- DEFAULT_ENABLE_TTI_EXPIRATION ,
115
+ DEFAULT_ENABLE_TIME_TO_IDLE_EXPIRATION ,
116
116
DEFAULT_USE_PREFIX ,
117
117
CacheKeyPrefix .simple (),
118
118
SerializationPair .fromSerializer (RedisSerializer .string ()),
@@ -121,7 +121,7 @@ public static RedisCacheConfiguration defaultCacheConfig(@Nullable ClassLoader c
121
121
}
122
122
123
123
private final boolean cacheNullValues ;
124
- private final boolean enableTtiExpiration ;
124
+ private final boolean enableTimeToIdle ;
125
125
private final boolean usePrefix ;
126
126
127
127
private final CacheKeyPrefix keyPrefix ;
@@ -134,13 +134,13 @@ public static RedisCacheConfiguration defaultCacheConfig(@Nullable ClassLoader c
134
134
private final TtlFunction ttlFunction ;
135
135
136
136
@ SuppressWarnings ("unchecked" )
137
- private RedisCacheConfiguration (TtlFunction ttlFunction , Boolean cacheNullValues , Boolean enableTtiExpiration ,
137
+ private RedisCacheConfiguration (TtlFunction ttlFunction , Boolean cacheNullValues , Boolean enableTimeToIdle ,
138
138
Boolean usePrefix , CacheKeyPrefix keyPrefix , SerializationPair <String > keySerializationPair ,
139
139
SerializationPair <?> valueSerializationPair , ConversionService conversionService ) {
140
140
141
141
this .ttlFunction = ttlFunction ;
142
142
this .cacheNullValues = cacheNullValues ;
143
- this .enableTtiExpiration = enableTtiExpiration ;
143
+ this .enableTimeToIdle = enableTimeToIdle ;
144
144
this .usePrefix = usePrefix ;
145
145
this .keyPrefix = keyPrefix ;
146
146
this .keySerializationPair = keySerializationPair ;
@@ -175,7 +175,7 @@ public RedisCacheConfiguration computePrefixWith(CacheKeyPrefix cacheKeyPrefix)
175
175
176
176
Assert .notNull (cacheKeyPrefix , "Function used to compute prefix must not be null" );
177
177
178
- return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTtiExpirationEnabled (),
178
+ return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (),
179
179
DEFAULT_USE_PREFIX , cacheKeyPrefix , getKeySerializationPair (), getValueSerializationPair (),
180
180
getConversionService ());
181
181
}
@@ -189,7 +189,7 @@ DEFAULT_USE_PREFIX, cacheKeyPrefix, getKeySerializationPair(), getValueSerializa
189
189
* @return new {@link RedisCacheConfiguration}.
190
190
*/
191
191
public RedisCacheConfiguration disableCachingNullValues () {
192
- return new RedisCacheConfiguration (getTtlFunction (), DO_NOT_CACHE_NULL_VALUES , isTtiExpirationEnabled (),
192
+ return new RedisCacheConfiguration (getTtlFunction (), DO_NOT_CACHE_NULL_VALUES , isTimeToIdleEnabled (),
193
193
usePrefix (), getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (),
194
194
getConversionService ());
195
195
}
@@ -202,7 +202,7 @@ public RedisCacheConfiguration disableCachingNullValues() {
202
202
* @return new {@link RedisCacheConfiguration}.
203
203
*/
204
204
public RedisCacheConfiguration disableKeyPrefix () {
205
- return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTtiExpirationEnabled (),
205
+ return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (),
206
206
DO_NOT_USE_PREFIX , getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (), getConversionService ());
207
207
}
208
208
@@ -221,9 +221,10 @@ public RedisCacheConfiguration disableKeyPrefix() {
221
221
*
222
222
* @return this {@link RedisCacheConfiguration}.
223
223
* @see <a href="https://redis.io/commands/getex/">GETEX</a>
224
+ * @since 3.2.0
224
225
*/
225
- public RedisCacheConfiguration enableTtiExpiration () {
226
- return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), ENABLE_IDLE_TIME_EXPIRATION ,
226
+ public RedisCacheConfiguration enableTimeToIdle () {
227
+ return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), USE_TIME_TO_IDLE_EXPIRATION ,
227
228
usePrefix (), getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (),
228
229
getConversionService ());
229
230
}
@@ -253,7 +254,7 @@ public RedisCacheConfiguration entryTtl(TtlFunction ttlFunction) {
253
254
254
255
Assert .notNull (ttlFunction , "TtlFunction must not be null" );
255
256
256
- return new RedisCacheConfiguration (ttlFunction , getAllowCacheNullValues (), isTtiExpirationEnabled (),
257
+ return new RedisCacheConfiguration (ttlFunction , getAllowCacheNullValues (), isTimeToIdleEnabled (),
257
258
usePrefix (), getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (),
258
259
getConversionService ());
259
260
}
@@ -268,7 +269,7 @@ public RedisCacheConfiguration serializeKeysWith(SerializationPair<String> keySe
268
269
269
270
Assert .notNull (keySerializationPair , "KeySerializationPair must not be null" );
270
271
271
- return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTtiExpirationEnabled (),
272
+ return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (),
272
273
usePrefix (), getKeyPrefix (), keySerializationPair , getValueSerializationPair (), getConversionService ());
273
274
}
274
275
@@ -282,7 +283,7 @@ public RedisCacheConfiguration serializeValuesWith(SerializationPair<?> valueSer
282
283
283
284
Assert .notNull (valueSerializationPair , "ValueSerializationPair must not be null" );
284
285
285
- return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTtiExpirationEnabled (),
286
+ return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (),
286
287
usePrefix (), getKeyPrefix (), getKeySerializationPair (), valueSerializationPair , getConversionService ());
287
288
}
288
289
@@ -296,7 +297,7 @@ public RedisCacheConfiguration withConversionService(ConversionService conversio
296
297
297
298
Assert .notNull (conversionService , "ConversionService must not be null" );
298
299
299
- return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTtiExpirationEnabled (),
300
+ return new RedisCacheConfiguration (getTtlFunction (), getAllowCacheNullValues (), isTimeToIdleEnabled (),
300
301
usePrefix (), getKeyPrefix (), getKeySerializationPair (), getValueSerializationPair (), conversionService );
301
302
}
302
303
@@ -310,14 +311,15 @@ public boolean getAllowCacheNullValues() {
310
311
/**
311
312
* Determines whether {@literal time-to-idle (TTI) expiration} has been enabled for caching.
312
313
* <p>
313
- * Use {@link #enableTtiExpiration ()} to opt-in and enable {@literal time-to-idle (TTI) expiration} for caching.
314
+ * Use {@link #enableTimeToIdle ()} to opt-in and enable {@literal time-to-idle (TTI) expiration} for caching.
314
315
*
315
316
* @return {@literal true} if {@literal time-to-idle (TTI) expiration} was configured and enabled for caching.
316
317
* Defaults to {@literal false}.
317
318
* @see <a href="https://redis.io/commands/getex/">GETEX</a>
319
+ * @since 3.2.0
318
320
*/
319
- public boolean isTtiExpirationEnabled () {
320
- return this .enableTtiExpiration ;
321
+ public boolean isTimeToIdleEnabled () {
322
+ return this .enableTimeToIdle ;
321
323
}
322
324
323
325
/**
0 commit comments