Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a main switch for caching in CachingDownloader. #4274

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

EreMaijala
Copy link
Contributor

No description provided.

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me! See below for a few very minor questions/suggestions.

public function __construct(
protected CacheManager $cacheManager,
protected ConfigManager $configManager,
protected bool $cacheEnabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth defaulting to true for stronger backward compatibility?

$this->setUpCache('default');
}

/**
* Get cache and initialize it, if necessary.
*
* @return StorageInterface
* @return ?StorageInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add "Return null if cache is disabled." to the description above.


$storage->expects($this->once())->method('hasItem')->with($testCacheKey)->willReturn(false);
$storage->expects($this->once())->method('addItem')->with($testCacheKey, $testBody);

$cacheManagerMock = $container->createMock(\VuFind\Cache\Manager::class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're changing code anyway, the line above could be simplified to use createMock as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants