<commit_before><?php
/**
 * Shows detailed information of all connected memcached servers, which is used by the TempStore class
 */

$tempstore_div = 'tss_'.mt_rand();

echo ' | '.ahref_js('cache', "return toggle_el('".$tempstore_div."')").' ';

$temp = TempStore::getInstance();

$css =
'display:none;'.
'overflow:auto;'.
'padding:4px;'.
'border:#000 1px solid;';

echo '<div id="'.$tempstore_div.'" style="'.$css.'">';

foreach ($temp->getServerStats() as $host => $stat)
{
    echo 'Read: <b>'.byte_count($stat['bytes_read']).'</b><br/>';
    echo 'Written: <b>'.byte_count($stat['bytes_written']).'</b><br/>';
    echo 'Used memory: <b>'.byte_count($stat['bytes']).'</b>'.
    ' (<b>'.round($stat['bytes'] / $stat['limit_maxbytes'] * 100, 1).'%</b>'.

    ' of <b>'.byte_count($stat['limit_maxbytes']).'</b>)'.
    '<br/>';
    echo '<br/>';

    echo 'Get: <b>'.$stat['get_hits'].'</b> hits, <b>'.$stat['get_misses'].'</b> misses<br/>';
    echo 'Cmd: <b>'.$stat['cmd_get'].'</b> get, <b>'.$stat['cmd_set'].'</b> set<br/>';
    echo '<br/>';

    echo 'Currently <b>'.$stat['curr_items'].'</b> items, <b>'.$stat['curr_connections'].'</b> connections<br/>';
    echo 'Total <b>'.$stat['total_items'].'</b> items, <b>'.$stat['total_connections'].'</b> connections<br/>';
    echo '<br/>';

    // ???
    echo 'Evictions: <b>'.$stat['evictions'].'</b><br/>';
    echo 'Threads: <b>'.$stat['threads'].'</b><br/>';<commit_msg>display if no server is configured<commit_after><?php
/**
 * Shows detailed information of all connected memcached servers, which is used by the TempStore class
 */

$tempstore_div = 'tss_'.mt_rand();

echo ' | '.ahref_js('cache', "return toggle_el('".$tempstore_div."')").' ';

$temp = TempStore::getInstance();

$css =
'display:none;'.
'overflow:auto;'.
'padding:4px;'.
'border:#000 1px solid;';

echo '<div id="'.$tempstore_div.'" style="'.$css.'">';

$pool = $temp->getServerStats();
if (!$pool) {
    echo 'No server configured';
    echo '</div>';
    return;
}

foreach ($pool as $host => $stat)
{
    echo 'Read: <b>'.byte_count($stat['bytes_read']).'</b><br/>';
    echo 'Written: <b>'.byte_count($stat['bytes_written']).'</b><br/>';
    echo 'Used memory: <b>'.byte_count($stat['bytes']).'</b>'.
    ' (<b>'.round($stat['bytes'] / $stat['limit_maxbytes'] * 100, 1).'%</b>'.

    ' of <b>'.byte_count($stat['limit_maxbytes']).'</b>)'.
    '<br/>';
    echo '<br/>';

    echo 'Get: <b>'.$stat['get_hits'].'</b> hits, <b>'.$stat['get_misses'].'</b> misses<br/>';
    echo 'Cmd: <b>'.$stat['cmd_get'].'</b> get, <b>'.$stat['cmd_set'].'</b> set<br/>';
    echo '<br/>';

    echo 'Currently <b>'.$stat['curr_items'].'</b> items, <b>'.$stat['curr_connections'].'</b> connections<br/>';
    echo 'Total <b>'.$stat['total_items'].'</b> items, <b>'.$stat['total_connections'].'</b> connections<br/>';
    echo '<br/>';

    // ???
    echo 'Evictions: <b>'.$stat['evictions'].'</b><br/>';
    echo 'Threads: <b>'.$stat['threads'].'</b><br/>';
{'fraction_non_alphanumeric': 0.29956243688993606, 'fraction_numerical': 0.006058566139347021, 'mean_word_length': 4.307142857142857, 'pattern_counts': {'":': 0, '<': 92, '<?xml version=': 0, '>': 94, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3620265', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1165, 'n_words': 201}