Skip to content

Commit

Permalink
Replace doctrine cache with symfony/cache which is PSR6
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanbes committed May 23, 2017
1 parent c29440e commit e16bd2d
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 161 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,22 @@ $apiClient->getSpectatorApi()->getCurrentGameByPlatformIdAndSummonerId('EUW1', 2

#### Use cache

By default Doctrine's VoidCache provider is implemented. You can specify another Cache provider (implementing doctrine CacheProvider abstract class) to the ApiClient.
By default Symfony NullAdapter cache is used. You can specify another Cache Adapter (implementing PSR6 Adapters) to the ApiClient.

Example with Predis :

```php
use Symfony\Component\Cache\Adapter\RedisAdapter;

$client = new \Predis\Client([
'scheme' => 'tcp',
'host' => '127.0.0.1',
'port' => 6379,
]);

$apiClient->setCacheProvider(new \Doctrine\Common\Cache\PredisCache($client));
$redisAdapter = new RedisAdapter($client);

$apiClient->setCacheProvider($redisAdapter);

// This will call the API and return to you an ApiResult object
$result = $apiClient->getSummonerApi()->getSummonerBySummonerName('MySummonerName');
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"description": "Wrapper for League of Legends API",
"require": {
"guzzlehttp/guzzle": "^6.0",
"doctrine/cache": "^1.6",
"predis/predis": "~1.0"
"symfony/cache": "^3.2"
},
"keywords": [
"lol", "api" , "league of legends", "lol api", "library"
],
"require-dev": {
"phpunit/phpunit": "^5.2"
"phpunit/phpunit": "^5.2",
"predis/predis": "~1.0"
},
"autoload": {
"psr-0": { "LoLApi": "src/" }
Expand Down
Loading

0 comments on commit e16bd2d

Please sign in to comment.