package
3.0.0+incompatible
Repository: https://github.com/donutloop/toolkit.git
Documentation: pkg.go.dev

# README

Usage

lease the resource for duration. When the lease expires, invoke func

Example

package main 

import (
	"github.com/donutloop/toolkit/lease"
)

func main() {
    leaser := lease.NewLeaser()
    leaser.Lease("cleanup-cache", time.Duration(1*time.Second), func() {
    	fmt.Println("cleaned up cache")
    })
}