Skip to content

Question about a problem with v. 2 cache - missing cache files #502

Closed
@ksdev-pl

Description

@ksdev-pl

Hi

A v. 2.0.1 noob question:

In the v. 1.* to use the cache I've used:

$githubClient = new \Github\Client(
    new \Github\HttpClient\CachedHttpClient(['cache_dir' => storage_path('app/cache')])
);

$paginator = new \Github\ResultPager($githubClient);

// The rest of the code with requests

I see the cache files using this code, so I know they are created.

In the v. 2 I've tried the php-cache/filesystem-adapter:

use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use Cache\Adapter\Filesystem\FilesystemCachePool;

// ...

$filesystemAdapter = new Local(storage_path('app')); // storage_path: laravel method pointing to "app" storage folder
$filesystem        = new Filesystem($filesystemAdapter);

$pool = new FilesystemCachePool($filesystem);

$client = new \Github\Client();
$client->addCache($pool);

$paginator = new \Github\ResultPager($client);

// The rest of the code with requests - exactly the same as for the 1.*

The end result is the same as in the v 1.* - that is, I'm successfully downloading a list of gists from github. During debugging I've checked that the cache plugin is added correctly.

The difference is - in the v. 2, with the code as seen above, no cache files are created.

The path is correct, because a "cache" folder is created in laravel storage app folder - but it's empty.

I've tried also with madewithlove/illuminate-psr-cache-bridge. The code with it is somewhat different (the folder path is configured in laravel config), the end result is correct and without errors (I'm downloading a list of gists), but I don't see the cache files, they are not created.

What am I missing? Or how to debug it, any help with where to check what the problem is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions