mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-03 17:44:48 +02:00
feat: add config option "path" for file cache (#3297)
This commit is contained in:
parent
4e616c7092
commit
9e9a697b8b
7 changed files with 67 additions and 27 deletions
31
tests/CacheTest.php
Normal file
31
tests/CacheTest.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace RssBridge\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CacheTest extends TestCase
|
||||
{
|
||||
public function testFileCache()
|
||||
{
|
||||
$temporaryFolder = sprintf('%s/rss_bridge_%s/', sys_get_temp_dir(), create_random_string());
|
||||
mkdir($temporaryFolder);
|
||||
|
||||
$sut = new \FileCache([
|
||||
'path' => $temporaryFolder,
|
||||
'enable_purge' => true,
|
||||
]);
|
||||
$sut->setScope('scope');
|
||||
$sut->purgeCache(-1);
|
||||
$sut->setKey(['key']);
|
||||
|
||||
$this->assertNull($sut->loadData());
|
||||
|
||||
$sut->saveData('data');
|
||||
$this->assertSame('data', $sut->loadData());
|
||||
$this->assertIsNumeric($sut->getTime());
|
||||
$sut->purgeCache(-1);
|
||||
|
||||
// Intentionally not deleting the temp folder
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue