Skip to content

Commit 137c659

Browse files
committed
Added "Custom cache adapter" readme section
1 parent 07b3fbf commit 137c659

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ $loop->run();
5353
If the first call returns before the second, only one query will be executed.
5454
The second result will be served from cache.
5555

56+
### Custom cache adapter
57+
58+
You can also specify a cache that [implements](https://github.com/reactphp/react/wiki/Users#cache-implmentations) [`CacheInterface`](https://github.com/reactphp/cache) to handle the record cache instead of the default in memory cache.
59+
60+
```php
61+
$cache = new React\Cache\ArrayCache();
62+
$loop = React\EventLoop\Factory::create();
63+
$factory = new React\Dns\Resolver\Factory();
64+
$dns = $factory->createCached('8.8.8.8', $loop, $cache);
65+
```
66+
5667
## Install
5768

5869
The recommended way to install this library is [through Composer](http://getcomposer.org).

0 commit comments

Comments
 (0)