Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,10 @@ $client = new \Tmdb\Client($token, [

```php
use Doctrine\Common\Cache\ArrayCache;
use Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage;

$client = new \Tmdb\Client($token, [
'cache' => [
'handler' => new DoctrineCacheStorage(new ArrayCache())
'handler' => new ArrayCache()
]
]
);
Expand Down
4 changes: 1 addition & 3 deletions examples/caching.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
$client = new \Tmdb\Client($token, [
'cache' => [
'enabled' => true,
'handler' => new \Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage(
new Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'my-cache-path')
)
'handler' => new Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'my-cache-path')
]
]);

Expand Down
5 changes: 1 addition & 4 deletions lib/Tmdb/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
namespace Tmdb;

use Doctrine\Common\Cache\FilesystemCache;
use Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage;
use Monolog\Handler\StreamHandler;
use Psr\Log\LogLevel;
use Symfony\Component\EventDispatcher\EventDispatcher;
Expand Down Expand Up @@ -272,9 +271,7 @@ protected function configureCacheOptions(array $options = [])
$options = $resolver->resolve(array_key_exists('cache', $options) ? $options['cache'] : []);

if ($options['enabled'] && !$options['handler']) {
$options['handler'] = new DoctrineCacheStorage(
new FilesystemCache($options['path'])
);
$options['handler'] = new FilesystemCache($options['path']);
}

return $options;
Expand Down
4 changes: 3 additions & 1 deletion lib/Tmdb/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ public function setDefaultCaching(array $parameters)
$this->adapter->getClient()->getConfig('handler')->push(
new CacheMiddleware(
new PrivateCacheStrategy(
$parameters['handler']
new DoctrineCacheStorage(
$parameters['handler']
)
)
),
'tmdb-cache'
Expand Down
3 changes: 1 addition & 2 deletions test/Tmdb/Tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
namespace Tmdb\Tests;

use Doctrine\Common\Cache\FilesystemCache;
use Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Tmdb\ApiToken;
use Tmdb\Client;
Expand Down Expand Up @@ -174,7 +173,7 @@ protected function getRequest($path, $parameters = [], $method = 'GET', $headers
'secure' => true,
'cache' => [
'enabled' => true,
'handler' => new DoctrineCacheStorage(new FilesystemCache(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-tmdb-api')),
'handler' => new FilesystemCache(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-tmdb-api'),
'path' => sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-tmdb-api',
'subscriber' => null
],
Expand Down