Skip to content

Commit

Permalink
Docs, refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
kakserpom committed Mar 19, 2013
1 parent 314a948 commit 8651820
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
11 changes: 3 additions & 8 deletions lib/AppInstance.php
Expand Up @@ -195,8 +195,7 @@ public function onShutdown($graceful = false) {
}

/**
* Create Request
* @todo more description needed
* Create Request instance
* @param object Request
* @param object Upstream application instance
* @return object Request
Expand Down Expand Up @@ -240,21 +239,17 @@ public function handleRequest($parent, $upstream) {

/**
* Handle the worker status
* @param int Status code @todo use constants in method
* @param int Status code
* @return boolean Result
*/
public function handleStatus($ret) {
if ($ret === self::EVENT_CONFIG_UPDATED) {
// script update
return $this->onConfigUpdated();
} elseif ($ret === self::EVENT_GRACEFUL_SHUTDOWN) {
// graceful worker shutdown for restart
return $this->shutdown(true);
} elseif ($ret === self::EVENT_HARD_SHUTDOWN) {
// shutdown worker
return $this->shutdown();
} else {
return true;
}
return true;
}
}
34 changes: 32 additions & 2 deletions lib/CacheItem.php
Expand Up @@ -8,15 +8,45 @@
* @author Zorin Vasily <kak.serpom.po.yaitsam@gmail.com>
*/
class CacheItem {
public $value;

/* Value
* @var mixed
*/
protected $value;

/* Listeners
* @var StackCallbacks
*/
protected $listeners;

/* Hits counter
* @var integer
*/
public $hits = 1;
public $listeners;

/* Expire time
* @var integer
*/
public $expire;

/* Establish TCP connection
* @param string Hostname
* @param integer Port
* @return boolean Success
*/
public function __construct($value) {
$this->listeners = new StackCallbacks;
$this->value = $value;
}

/* Establish TCP connection
* @param string Hostname
* @param integer Port
* @return boolean Success
*/
public function getHits() {
return $this->hits;
}
public function getValue() {
++$this->hits;
return $this->value;
Expand Down

0 comments on commit 8651820

Please sign in to comment.