cache_path = $cache_path; } /** * {@inheritdoc} */ public function get_path(): string { return '/page/cache-count'; } /** * {@inheritdoc} */ public function get_methods() { return WP_REST_Server::READABLE; } /** * {@inheritdoc} */ public function callback( WP_REST_Request $request ) { return new WP_REST_Response( [ 'count' => $this->cache_path->count(), ] ); } /** * {@inheritdoc} */ public function schema_callback(): array { return [ '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'cache count', 'type' => 'object', 'properties' => [ 'count' => [ 'description' => esc_html__( 'How many cached pages this site has across all compression types', 'solid-performance' ), 'type' => 'int', 'readonly' => true, ], ], ]; } }