-
Notifications
You must be signed in to change notification settings - Fork 360
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
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
No description provided.