Added support to serve redirects with status 301 and Cache-Control

This commit is contained in:
Alejandro Celaya
2020-06-17 19:01:56 +02:00
parent 186168b26c
commit 68db52679b
6 changed files with 66 additions and 8 deletions

View File

@@ -6,12 +6,15 @@ namespace Shlinkio\Shlink\Core;
use Cake\Chronos\Chronos;
use DateTimeInterface;
use Fig\Http\Message\StatusCodeInterface;
use PUGX\Shortid\Factory as ShortIdFactory;
use function sprintf;
const DEFAULT_SHORT_CODES_LENGTH = 5;
const MIN_SHORT_CODES_LENGTH = 4;
const DEFAULT_REDIRECT_STATUS_CODE = StatusCodeInterface::STATUS_FOUND;
const DEFAULT_REDIRECT_CACHE_LIFETIME = 30;
const LOCAL_LOCK_FACTORY = 'Shlinkio\Shlink\LocalLockFactory';
function generateRandomShortCode(int $length): string