Skip to content

Commit

Permalink
Add concrete example
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Jun 7, 2024
1 parent b684f10 commit 624c8d1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ $engine = new CachedEngine(
);
```

**Note:** This driver doesn't work well with the `LazyEngine` because of its closures that cannot be serialized.
Since this engine is already lazy, you can use it as a direct replacement.

## Drivers

This package provides drivers that can be used in a generic way:
Expand All @@ -80,3 +83,26 @@ $driver = new CachedDriver(
}
);
```

Concrete example:

```php
use Soap\CachedEngine\CacheConfig;
use Soap\CachedEngine\CachedDriver;
use Soap\Encoding\Driver;
use Soap\Wsdl\Loader\StreamWrapperLoader;
use Soap\WsdlReader\Wsdl1Reader;
use Symfony\Component\Cache\Adapter\RedisAdapter;

$driver = new CachedDriver(
new RedisAdapter(
RedisAdapter::createConnection('redis://localhost')
),
new CacheConfig('your-soap-driver', ttlInSeconds: 3600),
static fn() => Driver::createFromWsdl1(
(new Wsdl1Reader(
new StreamWrapperLoader()
))($wsdlLocation)
)
);
```

0 comments on commit 624c8d1

Please sign in to comment.