Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom cache location #306

Closed
sergeolkhovik opened this issue Jan 24, 2022 · 3 comments · Fixed by #308
Closed

Custom cache location #306

sergeolkhovik opened this issue Jan 24, 2022 · 3 comments · Fixed by #308

Comments

@sergeolkhovik
Copy link

Looks like this library uses TusPhp code (ankitpokhrel/tus-php) to upload videos?
I just upgraded from 2.0.5 to recent 3.x version and now get such messages:

PHP Warning:  file_put_contents(xxxx/vendor/ankitpokhrel/tus-php/.cache/tus_php.client.cache): Failed to open stream: Permission denied in xxxx/vendor/ankitpokhrel/tus-php/src/Cache/FileStore.php on line 191

I had to set this .cache folder writable for web server but personally I'd like to save all the caches in some other location. So Is it possible to configure Vimeo code with custom caches location (or even engine like redis that is supported by TusPhp)?

@aaronm67
Copy link
Collaborator

aaronm67 commented Jan 24, 2022

We're updating this library to allow a custom TusClient to be used, rather than forcing the Vimeo Tus Client.

Look for a release/documentation for your use case sometime this week.

@sergeolkhovik
Copy link
Author

Gentlemen, thanks for the update! I just tested it and found one small issue, here's my code:

class VimeoCache extends \Vimeo\Upload\TusClientFactory {
    public function getTusClient(string $base_uri, string $url): \TusPhp\Tus\Client
    {
        $client = new \Vimeo\Upload\TusClient($base_uri);
        $client->setUrl($url);
        $path = Path::Cache('vimeo');
        if (!is_dir($path)) {
            Path::mkdir($path);
        }
        $client->setCache(new \TusPhp\Cache\FileStore("$path"));
        return $client;
    }
}

based on your sample. It works and uploads but in my case it creates cache file not inside 'path/cache/vimeo' folder, but near with the name: vimeotus_php.client.cache:

image

If I change the line to:

        $client->setCache(new \TusPhp\Cache\FileStore("$path/"));

only in this case I get the file saved inside 'cache/vimeo' folder:

image

@aaronm67
Copy link
Collaborator

aaronm67 commented Feb 4, 2022

Thanks for the feedback!

I'll update the example to be more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants