<?php
/*
Plugin Name: Object-Cache-Manager
Plugin URI: http://herdian.ferdianto.com/object-cache-manager
Description: flush object cache on demand
Author: Herdian Ferdianto
Version: 0.1
Author URI: http://herdian.ferdianto.com/
*/

add_action( 'admin_menu', 'object_cache_manager_add_menu' );

function object_cache_manager_add_menu()
{
    add_options_page('Object Cache Managers', 'Object Cache Managers', 8, 'object-cache-managers.php', 'object_cache_manager_options');
}

function object_cache_manager_options()
{
	global $wp_object_cache;

    if ( isset($_POST['flush_cache']) )
    {
        $wp_object_cache->flush();
    }

    ?>
    <div class="wrap">

    <h2>Object Cache Stats</h2>
    <?php if ( isset($wp_object_cache) ): ?>
    <p>Hits: <?=$wp_object_cache->cache_hits?></p>
    <p>Miss: <?=$wp_object_cache->cache_misses?></p>
    <?php endif; ?>

    <h2>Flush Cache</h2>
    <form method="post" action="">
    <p class="submit">
    <input type="submit" class="button-primary" value="Flush Cache" name="flush_cache" />
    </p>
    </form>
    </div>
    <?php
}

