\StarDust
Uncomplicated process manager
Synopsis
class StarDust
{
- // constants
- const LOCK_NAME = 'stardustLockfree';
- const LOCK_PREFIX = 'stardustPID_';
- const CACHE_TIMEOUT = 2592000;
- const CACHE_KEY = 'STARDUST';
- const REALTIME_PRECISSION = 5;
- // members
- protected string $processName = '';
- protected $cache = '';
- protected array $allProcessStates = ;
- protected bool $separateKeys = false;
- // methods
- public void __construct()
- protected void initCache()
- protected void loadCache()
- public void setProcess()
- public void setZaWarudo()
- protected array getCachedData()
- protected void saveCache()
- protected bool pidIsOk()
- public void start()
- public void stop()
- protected bool isLocked()
- public bool isRunning()
- public bool notRunning()
- public array getState()
- public array getAllStates()
- protected void processStateUpdate()
- public void runBackgroundProcess()
Constants
Name | Value |
---|---|
LOCK_NAME | 'stardustLockfree' |
LOCK_PREFIX | 'stardustPID_' |
CACHE_TIMEOUT | 2592000 |
CACHE_KEY | 'STARDUST' |
REALTIME_PRECISSION | 5 |
Members
protected
- $allProcessStates
—
array
Contains current process states as processName=>processStats - $cache
—
System caching object placeholder - $processName
—
string
Contains current process name/identifier - $separateKeys
—
bool
Store each process state in separate STARDUST_PID cache keys
Methods
protected
- getCachedData() — Returns process data from cache
- initCache() — Inits system caching instance for further usage
- isLocked() — Performs check is database lock available or not?
- loadCache() — Loads current processes data from cache
- pidIsOk() — Checks is process name not empty and valid for setting/getting locks?
- processStateUpdate() — Updates some process execution stats
- saveCache() — Saves current process data into cache
public
- __construct()
- getAllStates() — Returns all process execution stats
- getState() — Returns current process execution stats
- isRunning() — Performs check for current process is running
- notRunning() — Performs check for current process is not running
- runBackgroundProcess() — Runs execution of some command as background process
- setProcess() — Sets instance process name/identifier
- setZaWarudo() — Sets instance process separate keys usage flag
- start() — Starts some process
- stop() — Stops some process