Class constructor
public __construct ( $dsn = FALSE ) : object | ||
$dsn | bool|string | |
return | object |
use Symfony\Component\Cache\Adapter\FilesystemAdapter; // Create a cache object with default options $cache = new FilesystemAdapter(); // Create a cache object with custom options $cache = new FilesystemAdapter( 'my_cache', // custom namespace 3600, // default lifespan of cache items in seconds '/path/to/cache/directory' // custom directory to store cache files );
use Illuminate\Cache\CacheManager; use Illuminate\Filesystem\FilesystemAdapter; // Create a cache manager object $manager = new CacheManager([]); // Create a file cache store with default options $store = $manager->driver('file'); // Create a file cache store with custom options $store = $manager->driver('file')->setPath('/path/to/cache/directory');This example uses the Laravel Cache library, and demonstrates how to create a cache object using the `CacheManager`. The first example creates a file cache store with default options, while the second example shows how to configure a custom cache directory.