GithubHelp home page GithubHelp logo

cachecmd's Introduction

cachecmd

Build Status codecov Go Report Card LICENSE

cachecmd runs a given command and caches the result of the command. Return cached result instead if cache found.

Installation

go get -u github.com/haya14busa/cachecmd/cmd/cachecmd

Example

$ cachecmd -ttl=10s date +%S
14 # First run
$ sleep 5s
$ cachecmd -ttl=10s date +%S
14 # Read from cache
$ sleep 5s
$ cachecmd -ttl=10s date +%S
24 # cache is expired. Run command again and update cache.

# Force update: set -ttl=0
$ cachecmd -ttl=0 date +%S

# TTL is 10 min. Return cache result immediately from cache and update cache
# in background for every run.
$ cachecmd -ttl=10m -async sh -c 'date +%s; sleep 3s'

# Cache result by current directory.
$ cachecmd -ttl=10m -key="$(pwd)" go list ./...
# https://github.com/github/hub
$ cachecmd -ttl=10m -key="$(pwd)" -async hub issue

๐Ÿฆ Author

haya14busa (https://github.com/haya14busa)

cachecmd's People

Contributors

haya14busa avatar mattn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.