Skip to content

Commit

Permalink
replace namespace in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
RikudouSage committed Oct 5, 2021
1 parent e30d0e1 commit c9ef685
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions README.md
Expand Up @@ -22,7 +22,7 @@ PSR-6 or PSR-16 implementation:

use Rikudou\DynamoDbCache\DynamoDbCache;
use Rikudou\DynamoDbCache\DynamoDbCacheBuilder;
use Aws\DynamoDb\DynamoDbClient;
use AsyncAws\DynamoDb\DynamoDbClient;

$cache = new DynamoDbCache('dynamoTableName', new DynamoDbClient([]));

Expand Down Expand Up @@ -51,14 +51,13 @@ You must create the DynamoDB table before using this library.

```php
<?php
use Aws\DynamoDb\DynamoDbClient;
use AsyncAws\DynamoDb\DynamoDbClient;
use Rikudou\DynamoDbCache\DynamoDbCache;

function get(string $key): string
{
$dynamoDbClient = new DynamoDbClient([
'region' => 'eu-central-1',
'version' => 'latest'
]);
$cache = new DynamoDbCache('cache', $dynamoDbClient); // the default field names are used - id, ttl and value

Expand All @@ -85,14 +84,13 @@ function get(string $key): string
```php
<?php

use Aws\DynamoDb\DynamoDbClient;
use AsyncAws\DynamoDb\DynamoDbClient;
use Rikudou\DynamoDbCache\DynamoDbCache;

function get(string $key): string
{
$dynamoDbClient = new DynamoDbClient([
'region' => 'eu-central-1',
'version' => 'latest'
]);
$cache = new DynamoDbCache('cache', $dynamoDbClient); // the default field names are used - id, ttl and value

Expand Down Expand Up @@ -120,7 +118,7 @@ You can automatically prefix all keys in DynamoDB by using the prefix configurat
<?php

use Rikudou\DynamoDbCache\DynamoDbCacheBuilder;
use Aws\DynamoDb\DynamoDbClient;
use AsyncAws\DynamoDb\DynamoDbClient;

$cache = DynamoDbCacheBuilder::create('myTable', new DynamoDbClient([]))
->withPrefix('myCustomPrefix#')
Expand Down Expand Up @@ -179,7 +177,7 @@ You then need to register it in the converter and assign the converter to the ca

use Rikudou\DynamoDbCache\Converter\CacheItemConverterRegistry;
use Rikudou\DynamoDbCache\DynamoDbCache;
use Aws\DynamoDb\DynamoDbClient;
use AsyncAws\DynamoDb\DynamoDbClient;
use Rikudou\DynamoDbCache\DynamoDbCacheBuilder;

// you don't need to add the default one as well, it will be added automatically if it's missing
Expand Down Expand Up @@ -214,7 +212,7 @@ in other languages (or different php app that doesn't have the same classes), yo
<?php
use Rikudou\DynamoDbCache\DynamoDbCache;
use Rikudou\DynamoDbCache\DynamoDbCacheBuilder;
use Aws\DynamoDb\DynamoDbClient;
use AsyncAws\DynamoDb\DynamoDbClient;
use Rikudou\DynamoDbCache\Encoder\JsonItemEncoder;

$encoder = new JsonItemEncoder(); // with default flags and depth
Expand Down

0 comments on commit c9ef685

Please sign in to comment.