refactor: integrate cache parameter into setDiscovery() method (#80)
* refactor: integrate cache parameter into setDiscovery() method - Add cache as 4th parameter to setDiscovery() - Rename $cache to $discoveryCache for clarity - Remove separate setCache() method - Update example to use new API * docs: update discovery caching documentation to use new API - Update examples to use cache parameter in setDiscovery() method - Remove references to separate setCache() method calls
This commit is contained in:
parent
e46b7c139d
commit
7d599f4f64
1 changed files with 9 additions and 21 deletions
|
|
@ -21,8 +21,7 @@ use Symfony\Component\Cache\Psr16Cache;
|
|||
|
||||
$server = Server::make()
|
||||
->setServerInfo('My Server', '1.0.0')
|
||||
->setDiscovery(__DIR__, ['.'])
|
||||
->setCache(new Psr16Cache(new ArrayAdapter())) // Enable caching
|
||||
->setDiscovery(__DIR__, ['.'], [], new Psr16Cache(new ArrayAdapter())) // Enable caching
|
||||
->build();
|
||||
```
|
||||
|
||||
|
|
@ -69,8 +68,7 @@ $cache = DoctrineProvider::wrap(new ArrayCache());
|
|||
$cache = new Psr16Cache(new ArrayAdapter());
|
||||
|
||||
$server = Server::make()
|
||||
->setDiscovery(__DIR__, ['.'])
|
||||
->setCache($cache)
|
||||
->setDiscovery(__DIR__, ['.'], [], $cache)
|
||||
->build();
|
||||
```
|
||||
|
||||
|
|
@ -81,8 +79,7 @@ $server = Server::make()
|
|||
$cache = new Psr16Cache(new FilesystemAdapter('mcp-discovery', 0, '/var/cache'));
|
||||
|
||||
$server = Server::make()
|
||||
->setDiscovery(__DIR__, ['.'])
|
||||
->setCache($cache)
|
||||
->setDiscovery(__DIR__, ['.'], [], $cache)
|
||||
->build();
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue