Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
梁杰芳
slm-fileview
Commits
8fdf462c
Commit
8fdf462c
authored
Oct 24, 2019
by
陈精华
Committed by
kl
Oct 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新功能点:缓存清理时间cron表达式支持自定义 link #I1147X
parent
f7c7411b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
application.properties
jodconverter-web/src/main/config/application.properties
+3
-2
ShedulerClean.java
...rter-web/src/main/java/cn/keking/utils/ShedulerClean.java
+3
-2
No files found.
jodconverter-web/src/main/config/application.properties
View file @
8fdf462c
...
...
@@ -27,8 +27,9 @@ spring.http.multipart.max-file-size=100MB
#redis连接
#spring.redisson.address = 192.168.1.204:6379
#spring.redisson.password = xxx
#缓存自动清理(每晚3点自动清理) true 为开启,注释掉或其他值都为关闭
cache.clean
=
true
cache.clean.enabled
=
true
#缓存自动清理时间,cache.clean.enabled = true时才有用,cron表达式,基于Quartz cron
cache.clean.cron
=
0 0 3 * * ?
#######################################可在运行时动态配置#######################################
#提供预览服务的地址,默认从请求url读,如果使用nginx等反向代理,需要手动设置
...
...
jodconverter-web/src/main/java/cn/keking/utils/ShedulerClean.java
View file @
8fdf462c
...
...
@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
* @since: 2019/6/11 7:45
*/
@Component
@ConditionalOnExpression
(
"'${cache.clean:false}'.equals('true')"
)
@ConditionalOnExpression
(
"'${cache.clean
.enabled
:false}'.equals('true')"
)
public
class
ShedulerClean
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ShedulerClean
.
class
);
...
...
@@ -24,7 +24,8 @@ public class ShedulerClean {
private
String
fileDir
=
ConfigConstants
.
getFileDir
();
@Scheduled
(
cron
=
"0 0 3 * * ?"
)
//每晚3点执行一次
//默认每晚3点执行一次
@Scheduled
(
cron
=
"${cache.clean.cron:0 0 3 * * ?}"
)
public
void
clean
()
{
LOGGER
.
info
(
"Cache clean start"
);
cacheService
.
cleanCache
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment