Coder Social home page Coder Social logo

cachesh's Introduction

cachesh

This is a wrapper command to cache the output, stderr and exit code of any random command.

The purpose is speed up executions of scripts, bootstraps, common tasks, etc.

Usage

cachesh <command> [args]

Check cachesh.sh for environment variables

Features

This is still in progress. I want to implement all these features, but I'm not in a hurry.

Requirements:

  • In bash: must be portable, not require dependencies
  • Cross platform support: MacOSX, linux, cygwin?
  • Fast and transparent

I want to implement the following features:

  • Cache any command stdout/stderr/exit using arguments as key
  • Customize TTL
  • Allow execute more complex expressions.
    • e.g: command_x | sort | uniq -c
  • Alternative keys and invalidations (customizable by options):
    • Use only the command path
    • environment variables
    • check if update is required with external command
  • Implement as much as possible using built-in functions to increase performance
  • List existing cached objects keys
  • Option to force update
  • Functions to invalidate cache
    • Using command, wildcards, etc.
    • Garbage collection: clean up old stuff
  • Keep output order of the stdout/stderr
  • Optionally report to the user when is cached or not cached version
  • Integrate this with bash-it: Speed up bash-it commands.
  • Find and include absolute command path when computing the key
  • Support to run as a symbolic link. For example:

mv /usr/local/bin/slow_program /usr/local/bin/slow_program.cachesh ln -s /usr/local/bin/cachesh /usr/local/bin/slow_program



## Notes and Questions

 * Q: Is SHA256 enough?
 * A: [This stackoverflow answer](http://stackoverflow.com/questions/4014090/is-it-safe-to-ignore-the-possibility-of-sha-collisions-in-practice/4014407#4014407) by [Thomas Pornin](http://stackoverflow.com/users/254279/thomas-pornin) gives a great response to that :)


## References/Credits

 * I got the idea from here: http://stackoverflow.com/questions/11900239/can-i-cache-the-output-of-a-command-on-linux-from-cli

cachesh's People

Contributors

keymon avatar

Watchers

 avatar  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.