PHP code example of claudiu-cristea / drupal-cache-adapter

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

    

claudiu-cristea / drupal-cache-adapter example snippets




use Drupal\Cache\Adapter\DrupalAdapter;
use ThirdParty\Library\Client;

class SomeService {

  public function doSomething() {
    ...
    $client = new Client(...);
    $adapter = new DrupalAdapter(\Drupal::service('cache.data'), 'some-prefix');
    $client->addCacheBackend($adapter);
    $client->fetch();
    ...
  }

}