Proxy_Cache::get_cache_group_name( string $route = null )
Summary
Returns a cache group name for a given REST request.
Parameters
- $route
-
(string) (Optional) REST request route.
Default value: null
Return
(string) Cache group name or an empty string if no cache group applies.
Source
File: src/BigCommerce/Proxy/Proxy_Cache.php
public function get_cache_group_name( $route = null ) { if ( $route ) { if ( preg_match( '@^' . preg_quote( self::PRODUCTS_PATH, '@' ) . '\/(?P<id>[0-9]+)(\/.*)?$@', $route, $matches ) && isset( $matches['id'] ) ) { return sprintf( '%s_product_%s', self::CACHE_GROUP_NAMESPACE, strval( $matches['id'] ) ); } foreach ( $this->get_paths() as $config_path ) { if ( 0 === strpos( $route, $config_path ) ) { return sprintf( '%s_%s', self::CACHE_GROUP_NAMESPACE, wp_unslash( $route ) ); } } } return ''; }