PHP code example of globalis / wp-cubi-transient-cache

1. Go to this page and download the library: Download globalis/wp-cubi-transient-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

globalis / wp-cubi-transient-cache example snippets




use Globalis\WP\Cubi\TransientCache\Cache;

$my_value = my_expensive_function();
Cache::set('my_key', $my_value, 'my_group');



use Globalis\WP\Cubi\TransientCache\Cache;

$my_value_cached = Cache::get('my_key', 'my_group');



use Globalis\WP\Cubi\TransientCache\Cache;

Cache::clear('my_key', 'my_group');



use Globalis\WP\Cubi\TransientCache\Cache;

Cache::clearGroups(['my_group']);



use Globalis\WP\Cubi\TransientCache\Template;

Template::get('templates/my-part', ['my_arg' => 'example'], 'my_group');



use Globalis\WP\Cubi\TransientCache\Cache;

Cache::clearGroups(['menus']);



wp_cubi_cache_set(string $key, mixed $value, string $group = 'all');
wp_cubi_cache_get(string $key, string $group = 'all');
wp_cubi_cache_clear(string $key, string $group = 'all');
wp_cubi_cache_clear_group(string $group = 'all');
wp_cubi_cache_clear_groups(array $groups = ['all']);
wp_cubi_get_template_part_cached(string $file, array $data = [], string $group = 'all', bool $return = false);



define('WP_CUBI_TRANSIENT_CACHE_BYPASS_ALL', true);



define('WP_CUBI_TRANSIENT_CACHE_BYPASS_TEMPLATES', true);



define('WP_CUBI_TRANSIENT_CACHE_DISABLE_AUTO_CACHE_NAV_MENUS', true);