PHP code example of arraypress / wp-storage-utils
1. Go to this page and download the library: Download arraypress/wp-storage-utils 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/ */
arraypress / wp-storage-utils example snippets
use ArrayPress\StorageUtils\Cache;
use ArrayPress\StorageUtils\Cast;
use ArrayPress\StorageUtils\Cleanup;
// Computed once an hour, and it can legitimately return false.
$is_eligible = Cache::remember( 'sc_eligible_' . $user_id, function () use ( $user_id ) {
return expensive_eligibility_check( $user_id );
} );
// Options come back as strings.
$limit = Cast::int( get_option( 'sc_download_limit' ), 5 );
// On uninstall, take everything with you.
Cleanup::options( 'sugarcart_' );
Cleanup::transients( 'sugarcart_' );
Cleanup::meta( 'sugarcart_', 'post' );