Skip to content
Li Zhineng edited this page Dec 9, 2023 · 5 revisions

The Tablestore driver extends your Laravel cache on top of Alibaba Cloud Tablestore, a serverless storage service with unlimited storage, the ability to query and retrieve items in milliseconds, and frees you from infrastructure maintenance.

Before you begin, make sure you have PHP 8.0+ or higher installed on your system.

Installation

You can install the package into the application using Composer:

composer require dew-serverless/laravel-tablestore-driver

Configure

Add a new cache store in your config/cache.php file:

return [

    // Define with Tablestore driver in stores

    'tablestore' => [
        'driver' => 'tablestore',
        'key' => env('ACS_ACCESS_KEY_ID'),
        'secret' => env('ACS_ACCESS_KEY_SECRET'),
        'endpoint' => env('TABLESTORE_ENDPOINT'),
        'instance' => env('TABLESTORE_INSTANCE'),
        'table' => env('TABLESTORE_CACHE', 'cache'),
    ],

];

And you're all set. The cache items will be stored to and queried from the Tablestore instance when you specify the store with Cache::driver('tablestore') or you may set it to the default one.

Session

You may also want to store the sessions on Tablestore, where the session driver is another cache-driven session backend. You could specify SESSION_DRIVER to "tablestore" and indicate which cache store should be used for the sessions by SESSION_STORE.

Clone this wiki locally