微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

LiteCron 分布式计划任务运行框架

程序名称:LiteCron

授权协议: MIT

操作系统: 跨平台

开发语言: Google Go

LiteCron 介绍

LiteCron 是一个基于 Go 的分布式计划任务运行框架,可以很容易的集成到 web app 中。它基于 Redis 实现分布式锁,无需特别的存储依赖。

  • 在 web app 中运行计划任务。

  • 构建分布式计划任务服务以替换系统计划任务服务。

//Step 1: init default cron client.
    litecron.InitDefaultCron(&litecron.MutexConfig{
        RedisConfig:&litecron.RedisConfig{
            DNS:"127.0.0.1:6379",
        },
        Prefix:"litecron/examples/defaults/",
        Factor:0.01,
    })
    //Register a cron job for every 2 seconds.
    litecron.Register("@every 2s",exampleHandle)
    go litecron.Run()
    time.Sleep(10 * time.Second)
    // Output:
  1. default cron client

  2. without default cron client

  3. mock multi processor

LiteCron 官网

https://github.com/imiskolee/litecron

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐