PHP code example of revenuewire / simple-cache

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

    

revenuewire / simple-cache example snippets



    /**
    * File Cache
    */
    $cache = new \RW\FileCache("/tmp/unit-test-" . uniqid());
    $k = "hello";
    $v = "world";
    $cache->set($k, $v); //return true
    $cache->get($k); //world
    $cache->has($k); //true
    $cache->delete($k); //true
    $cache->get($k); //null
    $cache->has($k); //false
    
    /**
    * DynamoDB Cache
    */
    $region = "us-west-1";
    $tableName = "sandbox-demo-cache";
    $cache = new \RW\DynamoCache($tableName, [
        "region" => $region,
    ]);