PHP code example of darrynten / any-cache

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

    

darrynten / any-cache example snippets


use DarrynTen\AnyCache;

$this->cache = new AnyCache()

$key = 'foo';
$value = 'bar';
$time = 60;

// Set a value
$this->cache()->set($key, $value, $time);

// Get a cached value
$result = $this->cache()->get($key);

// Check if a key exists
if ($this->cache->has($key)) {
  //
}

// Get and unset
$result = $this->cache()->pull($key);