PHP code example of fastd / storage

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

    

fastd / storage example snippets


$file = new File(__DIR__ . '/test.log');

$file->set('janhuang');

$content = $file->get();

use FastD\Storage\Redis\Redis;

$redis = new Redis([
    'host' => '',
    'port' => '',
    'auth' => ''
]);

$redis->set($name, $value, $ttl = 0);

$redis->get($name);

use FastD\Storage\Redis\Redis;

$redis = Redis::connect([
    'host' => '',
    'port' => '',
    'auth' => ''
]);

// 原生 redis 操作

$redis->mset($name, $value);

use FastD\Storage\Memcached\Memcached;

$memcached = new Memcached([
    'host' => '',
    'port' => ''
]);

$memcached->set('age', '18');

use FastD\Storage\Memcached\Memcached;

$memcached = Memcached::connect([
    'host' => '',
    'port' => ''
]);

use FastD\Storage\Ssdb\Ssdb;

$ssdb = new Ssdb([
    'host' => '',
    'port' => ''
]);

use FastD\Storage\Ssdb\Ssdb;

$ssdb = Ssdb::connect([
    'host' => '',
    'port' => ''
]);

phpunit