Skip to content

Commit 3b8be83

Browse files
nickvergessenbackportbot[bot]
authored andcommitted
chore(workflows): Migrate to CappedMemoryCache
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 25b49a2 commit 3b8be83

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

apps/workflowengine/lib/Check/RequestRemoteAddress.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
*/
77
namespace OCA\WorkflowEngine\Check;
88

9+
use OCP\Cache\CappedMemoryCache;
910
use OCP\IL10N;
1011
use OCP\IRequest;
1112
use OCP\WorkflowEngine\ICheck;
1213

1314
class RequestRemoteAddress implements ICheck {
14-
/** @var array<string, bool> */
15-
protected array $checked = [];
15+
protected CappedMemoryCache $checked;
1616

1717
/**
1818
* @param IL10N $l
@@ -22,6 +22,7 @@ public function __construct(
2222
protected IL10N $l,
2323
protected IRequest $request,
2424
) {
25+
$this->checked = new CappedMemoryCache();
2526
}
2627

2728
/**

apps/workflowengine/lib/Check/RequestTime.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
namespace OCA\WorkflowEngine\Check;
88

99
use OCP\AppFramework\Utility\ITimeFactory;
10+
use OCP\Cache\CappedMemoryCache;
1011
use OCP\IL10N;
1112
use OCP\WorkflowEngine\ICheck;
1213

1314
class RequestTime implements ICheck {
1415
public const REGEX_TIME = '([0-1][0-9]|2[0-3]):([0-5][0-9])';
1516
public const REGEX_TIMEZONE = '([a-zA-Z]+(?:\\/[a-zA-Z\-\_]+)+)';
1617

17-
/** @var bool[] */
18-
protected $cachedResults;
18+
protected CappedMemoryCache $cachedResults;
1919

2020
/**
2121
* @param ITimeFactory $timeFactory
@@ -24,6 +24,7 @@ public function __construct(
2424
protected IL10N $l,
2525
protected ITimeFactory $timeFactory,
2626
) {
27+
$this->cachedResults = new CappedMemoryCache();
2728
}
2829

2930
/**

0 commit comments

Comments
 (0)