PHP code example of ezsystems / stash-bundle

1. Go to this page and download the library: Download ezsystems/stash-bundle 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/ */

    

ezsystems / stash-bundle example snippets


public function registerBundles()
{
    return array(
        new Tedivm\StashBundle\TedivmStashBundle(),
    );
}

$pool = $this->container->get('stash');

$pool = $this->container->get('stash.custom_cache');

$item = $pool->getItem($id, 'info'); // cache keys, more than one can be used

$info = $item->get();

if($item->isMiss())
{
    $info = loadInfo($id);
    $item->set($userInfo, 60); // second parameter is TTL (in seconds or future \Datetime object)
}

return $info;