# ezcache/1.3.11/includes/Rest/CacheController.php

ezCache, version 1.3.11. 32 lines.

- Page: https://pluginprobe.com/plugins/ezcache/1.3.11/code/includes/Rest/CacheController.php
- Raw: https://pluginprobe.com/plugins/ezcache/1.3.11/raw/includes/Rest/CacheController.php
- Modified: 2020-01-29T08:46:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ezcache/1.3.11/code/includes/Rest/CacheController.php#L10-L20`.

```php
<?php
namespace Upress\EzCache\Rest;

use Exception;
use Upress\EzCache\Cache;
use WP_REST_Request;

class CacheController {

	function show() {
		try {
			$stats = Cache::instance()->get_cache_stats();
		} catch( Exception $ex) {
			return wp_send_json_error( [ 'error' => $ex->getMessage() ] );
		}

		return wp_send_json_success( $stats );
	}

	/**
	 * @param WP_REST_Request $request
	 */
	function destroy( $request ) {
		$input = $request->get_json_params();

		Cache::instance()->clear_cache();

		return wp_send_json_success( [ 'input' => $input ] );
	}

}

```
