Astra_Cache_Base::refresh_assets( String $cache_dir, int|mixed $post_id = null )
Refresh Assets with smart cache clearing logic.
Description
This method handles selective cache clearing:
- For post updates: Only clears cache for that specific post
- For customizer/manual refresh: Clears all cache
Parameters
- $cache_dir
-
(String) (Required) dirname of the cache.
- $post_id
-
(int|mixed) (Optional) Post ID for selective clearing, or other object types (e.g., WP_Customize_Manager).
Default value: null
Return
(void)
Source
File: classes/cache/class-astra-cache-base.php
public function refresh_assets( $cache_dir ) {
if ( ! current_user_can( 'edit_theme_options' ) ) {
return;
}
$this->init_cache();
astra_addon_filesystem()->reset_filesystem_access_status();
$this->delete_cache_files( $cache_dir );
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |