PHP code example of uspdev / cache

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

    

uspdev / cache example snippets


$pessoa = new Pessoa();
$lista = $pessoa->lista('nome');

use Uspdev\Cache\Cache;

$pessoa = new Pessoa();
$cache = new Cache($pessoa);
$lista = $cache->getCached('lista',['nome']);

$lista = $cache->getCached('lista','nome');

use Uspdev\Cache\Cache;

$cache = new Cache();
$lista = $cache->getCached('Pessoa::lista',['nome']);

$status = $cache->status();

$status = $cache->flush();

putenv('USPDEV_CACHE_DISABLE=1');

define('USPDEV_CACHE_DISABLE', true);

putenv('USPDEV_CACHE_EXPIRY=tempo_em_segundos');

$cache->expiry = tempo_em_segundos;

putenv('USPDEV_CACHE_SMALL=tamanho_em_bytes');

$cache->small = tamanho_em_bytes;
apt install php-memcached
bash
php test/runtests.php