https://bitbucket.org/sivann/runcached/

Spiros Ioannou 0f34b36668 Set version to 1.0 před 10 roky
Makefile 52ada10ea3 added files před 10 roky
README 52ada10ea3 added files před 10 roky
contributors.txt ca02f81d05 Initial commit with contributors před 10 roky
gittag.sh ec4be86182 Set version to 1.0 před 10 roky
runcached 52ada10ea3 added files před 10 roky
runcached.c 52ada10ea3 added files před 10 roky
runcached.py 52ada10ea3 added files před 10 roky
runcached.sh 52ada10ea3 added files před 10 roky

README

runcached (Run Cached)
------------------------------------------------------------------------------
Execute commands while caching their output for subsequent calls.
Command output will be cached for seconds and "replayed" for
any subsequent calls. Original exit status will also be emulated.

After cacheperiod has expired, command will be re-executed and a new result
will be cached.
Caching depends on command and arguments executed and the
path of the runcached executable. Cache results are stored in /tmp

You can use runcached to run resource-expensive commands multiple times,
parsing different parts of its output each time. Those commands will be
run only once for each cacheperiod.

Implementation is provided in 3 languages, python, C, BASH.


Usage:
======
Python:
runcached.py [-c cacheperiod]

C:
runcached [-c cacheperiod]

Bash
runcached.sh



Example:
========

1) Run the date command. Produce a new "date" every 5 seconds.
runcached.py -c 5 date

2) Query multiple parameters of mysql without re-running the query, and making
sure all of them correspond to the same time.

UserParameter=mysql.globalstatus[*],/usr/local/bin/runcached.py -c 20 /usr/bin/mysql -ANe \"show global status\"|egrep '$1\b'|awk '{print $ 2}'