PHP code example of germania-kg / cacheserviceprovider

1. Go to this page and download the library: Download germania-kg/cacheserviceprovider 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/ */

    

germania-kg / cacheserviceprovider example snippets



use Germania\CacheServiceProvider\CacheServiceProvider;

// A. Use with Slim or Pimple
$app = new \Slim\App;
$dic = $app->getContainer();
$dic = new Pimple\Container;

// B. Register Service Provider, 
// Defaults are unsecure!
$csp = new CacheServiceProvider( );
$csp = new CacheServiceProvider( sys_get_tmp_dir(), 3600);

// Pass custom cache directoy and lifetime (seconds)
$csp = new CacheServiceProvider( "path/to/cache", 3600);

// or, leave at defaults: 
$dic->register( $csp  );

$itempool = $dic['Cache.ItemPool'];