Skip to content

Commit

Permalink
Set cacheDir mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrimaud committed Apr 23, 2018
1 parent 9227ddb commit 2532fcc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ composer require pgrimaud/instagram-user-feed "^5.0"
## Usage of version ^5.0

```php
$cache = new Instagram\Storage\CacheManager();
$cache = new Instagram\Storage\CacheManager('/path/to/your/cache/folder');
$api = new Instagram\Api($cache);
$api->setUserName('pgrimaud');

Expand Down Expand Up @@ -202,7 +202,7 @@ If you want to use paginate, retrieve `endCursor` from previous call and add it
```php
// Initialization

$cache = new Instagram\Storage\CacheManager();
$cache = new Instagram\Storage\CacheManager('/path/to/your/cache/folder');
$api = new Instagram\Api($cache);
$api->setUserName('pgrimaud');

Expand Down
2 changes: 1 addition & 1 deletion examples/medias.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require __DIR__ . '/../vendor/autoload.php';

$cache = new Instagram\Storage\CacheManager();
$cache = new Instagram\Storage\CacheManager(__DIR__ . '/../cache/');

$api = new Instagram\Api($cache);
$api->setUserName('pgrimaud');
Expand Down
8 changes: 4 additions & 4 deletions src/Instagram/Storage/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class CacheManager

/**
* CacheManager constructor.
* @param null $cacheDir
* @param $cacheDir
*/
public function __construct($cacheDir = null)
public function __construct($cacheDir)
{
$this->cacheDir = $cacheDir ?: $this->cacheDir;
$this->cacheDir = $cacheDir;
}

/**
Expand All @@ -26,7 +26,7 @@ public function __construct($cacheDir = null)
*/
private function getCacheFile($userId)
{
return ($this->cacheDir ? $this->cacheDir : __DIR__ . '/../../../cache/') . $userId . '.cache';
return $this->cacheDir . $userId . '.cache';
}

/**
Expand Down

0 comments on commit 2532fcc

Please sign in to comment.