Skip to content

Commit

Permalink
Adds cache id, sets environment cache to 300, and prevents json_last_…
Browse files Browse the repository at this point in the history
…error from firing incorrectly.
  • Loading branch information
typhonius committed Oct 14, 2020
1 parent e302a8b commit bbd27e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Cli/CloudApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getApplicationUuid($name)
{
$cacheId = str_replace(':', '-', $name);

$cache = new FilesystemAdapter();
$cache = new FilesystemAdapter('acquiacli');
$return = $cache->get('application.' . $cacheId, function (ItemInterface $item) {
$count = 1;
$name = str_replace('application.', '', str_replace('-', ':', $item->getKey()), $count);
Expand Down Expand Up @@ -90,12 +90,12 @@ public function getEnvironment($uuid, $environment)
{
$cacheId = sprintf('environment.%s.%s', $uuid, $environment);

$cache = new FilesystemAdapter();
$cache = new FilesystemAdapter('acquiacli');
$return = $cache->get($cacheId, function (ItemInterface $item) {
$splitId = preg_split('/\./', $item->getKey());
$uuid = $splitId[1];
$environment = $splitId[2];
$item->expiresAfter(3600);
$item->expiresAfter(300);

$environmentsAdapter = new Environments($this->client);
$environments = $environmentsAdapter->getAll($uuid);
Expand Down
3 changes: 3 additions & 0 deletions tests/AcquiaCliTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function setUp()

protected function getPsr7StreamForFixture($fixture): StreamInterface
{
// Clear json_last_error().
json_decode('[]');

$path = sprintf(
'%s/vendor/typhonius/acquia-php-sdk-v2/tests/Fixtures/Endpoints/%s',
dirname(__DIR__),
Expand Down

0 comments on commit bbd27e6

Please sign in to comment.