Laravel filesystem sftp cached adapter Laravel filesystem sftp cached adapter laravel laravel

Laravel filesystem sftp cached adapter


It appears necessary to adjust your configuration:

In your config/filesystems.php file, add a 'caching' key to your storage:

'default' => [    'driver' => 'sftp-cached',    // ...    'cache' => [        'store' => 'apc',        'expire' => 600,        'prefix' => 'laravel',    ],],

This example is based on official documentation (https://laravel.com/docs/5.6/filesystem#caching), but it is not described well how the 'store' key is used here (where memcached is the example), and you would need to change the implementation of your driver to new Memcached($memcached); (with an instance to inject) instead.

In your case, since the sftp-cached driver implements $store = new Memory();, the cache config must reflect this with 'store' => 'apc' (which is RAM based cache). Available 'store' drivers are found in config/cache.php.

(If you use APC and get an error message Call to undefined function Illuminate\Cache\apc_fetch(), this PHP extension must be installed, see e.g. http://php.net/manual/en/apcu.installation.php)

Finally, I believe the 'prefix' key in config/filesystems.php must be set to the same as the cache key prefix in config/cache.php (which is 'prefix' => 'cache' by default).