Adds LoadRateLimiter with a two-layer check: 2-second minimum interval between requests, and a burst cap of 5 per 10-second window. Uses the distributed cache (Redis/APCu) so the limit applies across workers. Fails open when cache is unavailable so a cold cache never blocks users. Returns 429 Too Many Requests when throttled. Also updates ICacheFactory stub and FakeCacheFactory implementations to match the full interface (isAvailable, createDistributed, createInMemory).
13 lines
349 B
PHP
13 lines
349 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace OCP;
|
|
|
|
interface ICacheFactory {
|
|
public function isAvailable(): bool;
|
|
public function isLocalCacheAvailable(): bool;
|
|
public function createLocal(string $prefix = ''): ICache;
|
|
public function createDistributed(string $prefix = ''): ICache;
|
|
public function createInMemory(int $capacity = 512): ICache;
|
|
}
|