We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have tried multiple drivers, but it seems to fail at:
if ($this->config->shouldUseCache() && $this->config->cacheDriver->has($this->config->cacheId)) {
This is my ComponentScout:
ComponentScout
<?php use Illuminate\View\Component; use Spatie\StructureDiscoverer\Cache\FileDiscoverCacheDriver; use Spatie\StructureDiscoverer\Discover; use Spatie\StructureDiscoverer\StructureScout; class ComponentScout extends StructureScout { public ?string $path = null; public ?string $prefix = null; protected function definition(): Discover { return Discover::in($this->path) ->withCache($this->identifier(), $this->cacheDriver()) ->parallel() ->extending(Component::class) ->full(); } public function identifier(): string { return $this->prefix ?? static::class; } public function cacheDriver(): FileDiscoverCacheDriver { return new FileDiscoverCacheDriver( directory: sys_get_temp_dir(), filename: $this->identifier(), ); } public function prefix(string $prefix): static { $this->prefix = $prefix; return $this; } public function path(string $path): static { $this->path = $path; return $this; } }
This is how I call the scout:
$components = ComponentScout::create() ->path('App') ->prefix('my-components') ->get();
It does find them, but it doesn't use caching at all. It also doesn't create the /tmp/my-components file.
/tmp/my-components
The text was updated successfully, but these errors were encountered:
This seem to work:
$scout = ComponentScout::create() ->path($path) ->prefix($prefix); $structure = $scout->isCached() ? $scout->get() : $scout->cache();
So if I understand correctly, you need to first make the cache (this calls put), and later use get, to retrieve the cached result.
put
get
Should the isCached() not be part of the get() method on the Discover class?
isCached()
get()
Discover
Thanks.
Sorry, something went wrong.
We'll handle this further in #18
Merge pull request #18 from francoism90/main
c1ee013
Create cache when requested (fixes #17)
No branches or pull requests
I have tried multiple drivers, but it seems to fail at:
This is my
ComponentScout
:This is how I call the scout:
It does find them, but it doesn't use caching at all. It also doesn't create the
/tmp/my-components
file.The text was updated successfully, but these errors were encountered: