PluginProbe
ezCache / 1.2
ezCache v1.2
2.6.5 2.6.4 2.6.2 2.6.3 2.6.1 2.6.0 2.5.6 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5 2.2.1 2.2.2 trunk 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.3 1.3.1 1.3.10 1.3.11 All 49 releases
ezcache / includes / Rest / CacheController.php

CacheController.php in ezCache 1.2, at includes/Rest/CacheController.php

32 lines 596 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Upress\EzCache\Rest;
3
4 use Exception;
5 use Upress\EzCache\Cache;
6 use WP_REST_Request;
7
8 class CacheController {
9
10 function show() {
11 try {
12 $stats = Cache::instance()->get_cache_stats();
13 } catch( Exception $ex) {
14 return wp_send_json_error( [ 'error' => $ex->getMessage() ] );
15 }
16
17 return wp_send_json_success( $stats );
18 }
19
20 /**
21 * @param WP_REST_Request $request
22 */
23 function destroy( $request ) {
24 $input = $request->get_json_params();
25
26 Cache::instance()->clear_cache();
27
28 return wp_send_json_success( [ 'input' => $input ] );
29 }
30
31 }
32