PHP code example of ferdiunal / laravel-cache-couchdb

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

    

ferdiunal / laravel-cache-couchdb example snippets


'default' => env('CACHE_DRIVER', 'file'),
...
'couchdb' => [
    'driver' => 'couchdb',
    'host' => env('COUCHDB_HOST', 'localhost'),
    'port' => env('COUCHDB_PORT', 5984),
    'user' => env('COUCHDB_USERNAME', null),
    'password' => env('COUCHDB_PASSWORD', null),
    'ip' => env('COUCHDB_IP', null),
    'ssl' => env('COUCHDB_SSL', false),
    'path' => env('COUCHDB_PATH', null),
    'logging' => env('COUCHDB_LOGGING', false),
    'timeout' => env('COUCHDB_TIMEOUT', 0.01),
    'dbname' => env('COUCHDB_DATABASE', 'your_database_name'),
    'prefix' => env('CACHE_PREFIX', 'your_cache_prefix'),
];

// Store an item in the cache for 10 minutes
Cache::put('key', 'value', 10);

// Retrieve an item from the cache by key
$value = Cache::get('key');

// Retrieve multiple items from the cache by keys
$values = Cache::many(['key1', 'key2']);

// Increment the value of an item in the cache
Cache::increment('key');

// Decrement the value of an item in the cache
Cache::decrement('key');

// Remove an item from the cache
Cache::forget('key');

// Remove all items from the cache
Cache::flush();

// Store an item in the cache with a tag
Cache::tags(['tag1', 'tag2'])->put('key', 'value', 10);

// Retrieve all items with a tag
Cache::tags('tag1')->get('key');

// Remove all items with a tag
Cache::tags('tag1')->flush();