请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

老师想问下Quartz执行多个任务怎么做到

刚用SpringBoot搭建了项目,因为考虑到Redis会改动数据,想弄个一个定时任务定时清空redis的keys,看了CSDN和简书上面实现使用了不同的方法感觉有点头晕。但是项目好像只用Quartz实现了定时统计商品,如果我需要再加上一个任务,需要怎么在SpringBoot下的实体类中配置呢。

正在回答 回答被采纳积分+3

1回答

翔仔 2017-12-16 00:25:26

同学好,一般不需要quartz去清除,可以设置redis key的过期时间即可

如果还是要加上一个任务,那么就创建一个job 一个crontrigger 绑定到factory即可 :) 同学可以参考下面链接去处理

http://blog.csdn.net/lyg_come_on/article/details/78223344

0 回复 有任何疑惑可以回复我~
  • 提问者 ELLIOT4038596 #1
    老师,其实我访问前端的页面  这样报错 "success": false,
    "errMsg": "Could not get a resource from the pool"
    然后debug后发现是redis的问题,key存在但是取不到值好像
    回复 有任何疑惑可以回复我~ 2017-12-16 01:10:07
  • 提问者 ELLIOT4038596 #2
    # Server
    redis_version:4.0.3
    redis_git_sha1:00000000
    redis_git_dirty:0
    redis_build_id:9a0b1ffee3ec294e
    redis_mode:standalone
    os:Linux 3.10.0-514.26.2.el7.x86_64 x86_64
    arch_bits:64
    multiplexing_api:epoll
    atomicvar_api:atomic-builtin
    gcc_version:4.8.5
    process_id:8898
    run_id:7199b4145b4d2ab40c86426119d84b569fb6db20
    tcp_port:6379
    uptime_in_seconds:24458
    uptime_in_days:0
    hz:10
    lru_clock:3408191
    executable:/root/redis-4.0.3/src/redis-server
    config_file:/root/redis-4.0.3/redis.conf
    
    # Clients
    connected_clients:1
    client_longest_output_list:0
    client_biggest_input_buf:0
    blocked_clients:0
    
    # Memory
    used_memory:831176
    used_memory_human:811.70K
    used_memory_rss:7876608
    used_memory_rss_human:7.51M
    used_memory_peak:851040
    used_memory_peak_human:831.09K
    used_memory_peak_perc:97.67%
    used_memory_overhead:815526
    used_memory_startup:765632
    used_memory_dataset:15650
    used_memory_dataset_perc:23.88%
    total_system_memory:1928933376
    total_system_memory_human:1.80G
    used_memory_lua:37888
    used_memory_lua_human:37.00K
    maxmemory:0
    maxmemory_human:0B
    maxmemory_policy:noeviction
    mem_fragmentation_ratio:9.48
    mem_allocator:jemalloc-4.0.3
    active_defrag_running:0
    lazyfree_pending_objects:0
    回复 有任何疑惑可以回复我~ 2017-12-16 01:12:04
  • 提问者 ELLIOT4038596 #3
    想问一下这样靠quartz自动清除keys 可以解决此种报错吗
    回复 有任何疑惑可以回复我~ 2017-12-16 01:17:01
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信