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

Set cache driver & path on the bound Storyblok\Client instance #57

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

codyworthen
Copy link
Contributor

There are multiple places in Storyblok\Client that call a private method called isCache(): bool and if the private property $cacheis not set via the publicsetCachemethod, then$client->cache` will be null.

storyblok/storyblok-php-client says that the cache needs to be set if caching is going to be used here

@codyworthen
Copy link
Contributor Author

@RicLeP @roberto-butti I was wondering if I could get some feedback on this. Thanks

@roberto-butti
Copy link
Contributor

From the Storyblok client perspective, the cache can be set via the setCache method.

$client->setCache('filesystem',
    [
        'path' => 'cache',
        'default_lifetime' => 3600
    ]);

You can use the file system or a database for example.
Because the Laravel packages uses under the hood the PHP client, the Laravel packages should set the cache (or via config or exposing a method).

I would like to listen to the thoughts of @RicLeP the maintainer of this package. Open to offer my support.

@RicLeP
Copy link
Owner

RicLeP commented Nov 18, 2024

I like this, I think we should be making use of the cache driver.

Couple of thoughts

  1. should we let the lifetime be configured too?
  2. should be config keys be prefixed with sb_ or similar to differentiate them from the Laravel caching the package uses and help identify this is configuring the underlying Storyblok client?

@RicLeP RicLeP merged commit 7df0d09 into RicLeP:master Nov 22, 2024
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 this pull request may close these issues.

3 participants