diff --git a/web/yaamp/config.php b/web/yaamp/config.php
index b6f5cef..680c12e 100644
--- a/web/yaamp/config.php
+++ b/web/yaamp/config.php
@@ -57,6 +57,19 @@ return array(
'charset'=>'utf8',
'schemaCachingDuration'=>3600,
),
+
+ 'cache'=>array(
+ 'class'=>'CMemCache',
+ 'keyPrefix'=>'',
+ 'servers'=>array(
+ array(
+ 'host'=>'127.0.0.1',
+ 'port'=> 11211,
+ 'weight'=> 60,
+ ),
+ ),
+ ),
+
),
diff --git a/web/yaamp/console.php b/web/yaamp/console.php
index 452fe74..65779e4 100644
--- a/web/yaamp/console.php
+++ b/web/yaamp/console.php
@@ -11,7 +11,14 @@ return array(
'basePath'=>YAAMP_HTDOCS."/yaamp",
'preload'=>array('log'),
- 'import'=>array('application.components.*'),
+
+ // autoloading model and component classes
+ 'import'=>array(
+ 'application.components.*',
+ 'application.commands.*',
+ 'application.models.*',
+ 'application.extensions.*',
+ ),
'components'=>array(
@@ -20,22 +27,6 @@ return array(
'baseUrl' => '',
),
- // autoloading model and component classes
- 'import'=>array(
- 'application.components.*',
- 'application.commands.*',
- //'application.commands.shell.*',
- 'application.models.*',
- 'application.extensions.*',
- ),
-
-
- 'urlManager'=>array(
- 'urlFormat'=>'path',
- 'showScriptName'=>false,
- 'appendParams'=>false,
- ),
-
'assetManager'=>array(
'basePath'=>YAAMP_HTDOCS."/assets"
),
@@ -55,11 +46,6 @@ return array(
),
),
- 'user'=>array(
- 'allowAutoLogin'=>true,
- 'loginUrl'=>array('site/login'),
- ),
-
'db'=>array(
'class'=>'CDbConnection',
'connectionString'=>"mysql:host=".YAAMP_DBHOST.";dbname=".YAAMP_DBNAME,
@@ -71,12 +57,20 @@ return array(
'charset'=>'utf8',
'schemaCachingDuration'=>3600,
),
- ),
+ 'cache'=>array(
+ 'class'=>'CMemCache',
+ 'keyPrefix'=>'',
+ 'servers'=>array(
+ array(
+ 'host'=>'127.0.0.1',
+ 'port'=> 11211,
+ 'weight'=> 60,
+ ),
+ ),
+ ),
+
+ ),
);
-
-
-
-
diff --git a/web/yaamp/core/common/util.php b/web/yaamp/core/common/util.php
index f06d2c0..5d0f958 100644
--- a/web/yaamp/core/common/util.php
+++ b/web/yaamp/core/common/util.php
@@ -2,9 +2,21 @@
function controller()
{
+ // console app has no controller
+ if (app() instanceof CConsoleApplication)
+ return app();
+
return app()->getController();
}
+function cache()
+{
+ if (app() instanceof CConsoleApplication)
+ return app()->cache;
+
+ return app()->getController()->memcache;
+}
+
function arraySafeVal($arr,$p,$default=NULL)
{
if (isset($arr[$p]))
diff --git a/web/yaamp/modules/site/common.php b/web/yaamp/modules/site/common.php
index 9b113f4..abca328 100644
--- a/web/yaamp/modules/site/common.php
+++ b/web/yaamp/modules/site/common.php
@@ -7,13 +7,11 @@ JavascriptFile("/extensions/jqplot/plugins/jqplot.highlighter.js");
echo getAdminSideBarLinks();
-
-//Memcache
//Eval
-//Jobs
?>
-
+Memcache
Connections
+
Rental
diff --git a/web/yaamp/modules/site/connections_results.php b/web/yaamp/modules/site/connections_results.php
index eaae208..3429f35 100644
--- a/web/yaamp/modules/site/connections_results.php
+++ b/web/yaamp/modules/site/connections_results.php
@@ -3,8 +3,6 @@
$last = dboscalar("select max(last) from connections");
$list = getdbolist('db_connections', "1 order by id desc");
-echo count($list)." connections
";
-
//echo "
";
showTableSorter('maintable');
echo "";
@@ -12,7 +10,7 @@ echo "";
echo "ID | ";
echo "User | ";
echo "Host | ";
-echo "Db | ";
+echo "Database | ";
echo "Idle | ";
echo "Created | ";
echo "Last | ";
@@ -43,6 +41,4 @@ foreach($list as $conn)
echo "
";
-
-
-
+echo count($list)." connections to the database
";
diff --git a/web/yaamp/modules/site/memcached.php b/web/yaamp/modules/site/memcached.php
index 0d24370..bed417b 100644
--- a/web/yaamp/modules/site/memcached.php
+++ b/web/yaamp/modules/site/memcached.php
@@ -5,6 +5,42 @@ echo "refresh
";
$memcache = controller()->memcache->memcache;
$a = memcache_get($this->memcache->memcache, 'url-map');
+function printStats($stat)
+{
+ echo "
";
+ echo "";
+ echo "Memcache Server version | ".$stat["version"]." |
";
+ echo "Process id of this server process | ".$stat["pid"]." |
";
+ echo "Server uptime | ".$stat["uptime"]." seconds |
";
+ echo "Accumulated user time for this process | ".round($stat["rusage_user"],1)." seconds |
";
+ echo "Accumulated system time for this process | ".round($stat["rusage_system"],1)." seconds |
";
+ echo "Total number of items stored by this server start | ".$stat["total_items"]." |
";
+ echo "Number of open connections | ".$stat["curr_connections"]." |
";
+ echo "Total number of connections opened since server start | ".$stat["total_connections"]." |
";
+ echo "Number of connection structures allocated by the server | ".$stat["connection_structures"]." |
";
+ echo "Cumulative number of retrieval requests | ".$stat["cmd_get"]." |
";
+ echo " Cumulative number of storage requests | ".$stat["cmd_set"]." |
";
+
+ $percCacheHit=((real)$stat["get_hits"]/ (real)$stat["cmd_get"] *100);
+ $percCacheHit=round($percCacheHit,3);
+ $percCacheMiss=100-$percCacheHit;
+
+ echo "Number of keys that have been requested and found | ".$stat["get_hits"]." ($percCacheHit%) |
";
+ echo "Number of items that have been requested and not found | ".$stat["get_misses"]." ($percCacheMiss%) |
";
+
+ $MBRead= (real)$stat["bytes_read"]/(1024*1024);
+
+ echo "Total number of bytes read by this server from network | ".$MBRead." MB |
";
+ $MBWrite=(real) $stat["bytes_written"]/(1024*1024) ;
+ echo "Total number of bytes sent by this server to network | ".$MBWrite." MB |
";
+ $MBSize=(real) $stat["limit_maxbytes"]/(1024*1024) ;
+ echo "Size allowed to use for storage | ".$MBSize." MB |
";
+ echo "Items removed from cache to free memory for new items | ".$stat["evictions"]." |
";
+ echo "
";
+}
+
+printStats($this->memcache->memcache->getStats());
+
$res = array();
function cmp($a, $b)
@@ -23,7 +59,8 @@ foreach($a as $url=>$n)
usort($res, 'cmp');
-echo "
";
+echo '';
+echo '
';
echo "";
echo "";
echo "Url | ";
@@ -51,8 +88,4 @@ foreach($res as $item)
echo "
";
}
-echo "
";
-
-
-
-
+echo "
";