File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,20 +14,23 @@ The most basic usage is to just create a resolver through the resolver
1414factory. All you need to give it is a nameserver, then you can start resolving
1515names, baby!
1616
17+ ``` php
1718 $loop = React\EventLoop\Factory::create();
1819 $factory = new React\Dns\Resolver\Factory();
1920 $dns = $factory->create('8.8.8.8', $loop);
2021
2122 $dns->resolve('igor.io')->then(function ($ip) {
2223 echo "Host: $ip\n";
2324 });
25+ ```
2426
2527But there's more.
2628
2729## Caching
2830
2931You can cache results by configuring the resolver to use a ` CachedExecutor ` :
3032
33+ ``` php
3134 $loop = React\EventLoop\Factory::create();
3235 $factory = new React\Dns\Resolver\Factory();
3336 $dns = $factory->createCached('8.8.8.8', $loop);
@@ -41,6 +44,7 @@ You can cache results by configuring the resolver to use a `CachedExecutor`:
4144 $dns->resolve('igor.io')->then(function ($ip) {
4245 echo "Host: $ip\n";
4346 });
47+ ```
4448
4549If the first call returns before the second, only one query will be executed.
4650The second result will be served from cache.
You can’t perform that action at this time.
0 commit comments