Skip to content

Commit 41233c1

Browse files
committed
Syntax highlighting
1 parent c20e2e2 commit 41233c1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,23 @@ The most basic usage is to just create a resolver through the resolver
1414
factory. All you need to give it is a nameserver, then you can start resolving
1515
names, 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

2527
But there's more.
2628

2729
## Caching
2830

2931
You 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

4549
If the first call returns before the second, only one query will be executed.
4650
The second result will be served from cache.

0 commit comments

Comments
 (0)