-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
status: duplicateA duplicate of another issueA duplicate of another issue
Description
Hi, I want a way to disable cleanup cron in Spring Session Data Redis (as described in previous conversation: #1119 (comment) ).
Here is a issue that describes about the matter.
TL;DR
- Sometime user want to disable cleanup cron of Spring Session Data Redis and Spring Session JDBC
- There was a known workaround to set
cleanup-cron=0 0 5 31 2(February 31st, never comes), but it does not work with recent version of spring-context - It is difficult to override
RedisHttpSessionConfigurationandJdbcHttpSessionConfigurationto prevent cleanup cron. - What I want is a way to disable cleanup cron. And also enable to use property placeholder in
cleanupCronattribute.
Motivation
I want to disable cleanup cron because ...
- use case 1) When I have many web servers, I want to enable cleanup-cron on only one server and want to disable cleanup-cron on other servers to reduce DataStore load and connection pool usage.
- use case 2) When SessionDeletedEvent and SessionExpiredEvent seem not to be needed (also no need to close WebSocket connections associated with the session), I want to disable cleanup-cron entirely.
Limitation of current implementation
As shown in example code of #1119 (comment), current RedisHttpSessionConfiguration and JdbcHttpSessionConfiguration does not formal way to disable cleanup cron.
My understanding is that above example code is a only way currently and such way is poor in maintainability.
What I want
My proposal is to add following attributes to disable cleanup cron:
- Add
boolean enableCleanupCron = trueoptional attribute into@EnableRedisHttpSessionand@EnableJdbcHttpSession- Default value is
true, it is same with existing behavior - When it is
false,RedisHttpSessionConfigurationandJdbcHttpSessionConfigurationwill not register CronTask
- Default value is
- Enable to use property placeholder in
disableCleanupCronandcleanupCronattributes- As described in use case A, sometimes user want to vary cleanup cron setting by environment.
- Use
StringValueResolverto resolve placeholders seems to be a way to resolve placeholders (current implementation uses it onredisNamespaceattribute but not oncleanupCron). - Current
cleanupCronattribute seems to accept only cron form (e.g.0 0 5 31 2). Thus introducing StringValueResolver is not breaking change in my understanding.
Metadata
Metadata
Assignees
Labels
status: duplicateA duplicate of another issueA duplicate of another issue