Permalink
Browse files

Docs, refactoring

  • Loading branch information...
kakserpom committed Mar 19, 2013
1 parent 314a948 commit 8651820329434aeabf095e6b880fac9e8366b8ca
Showing with 35 additions and 10 deletions.
  1. +3 −8 lib/AppInstance.php
  2. +32 −2 lib/CacheItem.php
View
@@ -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
@@ -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;
}
}
View
@@ -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;

0 comments on commit 8651820

Please sign in to comment.