PHP code example of alleyinteractive / wp-big-pit

1. Go to this page and download the library: Download alleyinteractive/wp-big-pit 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/ */

    

alleyinteractive / wp-big-pit example snippets




use Alley\WP\Big_Pit;

$external_id  = 'abcdef12345';
$api_response = '{"id":"abcdef12345","title":"The Best Movie Ever","rating":5}';

$big_pit = Big_Pit::instance();

$big_pit->set( $external_id, $api_response, 'movie_reviews' );
$big_pit->get( $external_id, 'movie_reviews' ); // '{"id":"abcdef12345","title":"The Best Movie Ever","rating":5}'
$big_pit->delete( $external_id, 'movie_reviews' );
$big_pit->flush_group( 'movie_reviews' );



// Each instance of the cache adapter is bound to a group. Create different instances to save to different groups.
$cache = \Alley\WP\SimpleCache\Big_Pit_Adapter::create( group: 'movie_reviews' );

$cache->get( /* ... */ );
$cache->set( /* ... */ );
$cache->delete( /* ... */ );
$cache->clear();
// etc.