1. Go to this page and download the library: Download silvanus/svangr 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/ */
silvanus / svangr example snippets
// Transient cache strategy.
use Silvanus\Svangr\Cache\Transient as Cache;
/**
* Create new cache instance with key.
* Key is used as a namespace
* that binds key/value pairs together.
*/
$cache = new Cache('resources');
// Check existance of value in cache.
$cache->has('myStuff'); // true / false.
// Set individual value.
$cache->set('myStuff', myTimeConsumingFunction());
// Set individual value with refresh time -> defaults to 60 minutes if empty.
$cache->set('willBeGoneInFiveMinutes', myFiveMinuteStuff(), 300)
// Get individual value.
$cache->get('myStuff');
// Delete individual value.
$cache->delete('myStuff'):
// Transient cache strategy.
use Silvanus\Svangr\Cache\Transient as Cache;
// Namespaced cache instance.
$cache = new Cache('resources');
// Set many values
$cache->setMultiple( array( 'events' => myFoo(), 'items' => myBar(), 'resources' => myBaz() ) );
// Get many values. Returned as key => value array.
$cache->getMultiple( 'events', 'items', 'resources' );
// Delete multiple values.
$cache->deleteMultiple( array( 'events', 'items', 'resources' ) ):
// Transient cache strategy.
use Silvanus\Svangr\Cache\Transient as Cache;
// Namespaced cache instance.
$cache = new Cache('resources');
/**
* Clear all cache values in namespace.
* NOTE: uses WPDB.
* If your installation has drop-in replacement for transients,
* clear might not work. Use delete() method then.
*/
$cache->clear();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.