Skip to content

Commit 2c5894e

Browse files
author
Ulf Tietze
committed
WIP: First Version of some LinkManagement
1 parent bba9f0d commit 2c5894e

File tree

3 files changed

+57
-4
lines changed

3 files changed

+57
-4
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Firegento\CacheWarmup\Api;
4+
5+
use Firegento\CacheWarmup\Api\Data\CacheRouteInterface;
6+
use Firegento\CacheWarmup\Api\Data\CacheTagInterface;
7+
8+
interface RoutesTagsLinkManagementInterface
9+
{
10+
/**
11+
* @param CacheRouteInterface $cacheRoute
12+
* @param CacheTagInterface[] $tags
13+
*/
14+
public function linkRouteToTags(CacheRouteInterface $cacheRoute, array $tags): void;
15+
16+
}

Model/CacheTagRepository.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Firegento\CacheWarmup\Model;
44

5-
65
use Firegento\CacheWarmup\Api\CacheTagRepositoryInterface;
76
use Firegento\CacheWarmup\Api\Data\CacheTagInterface;
87
use Firegento\CacheWarmup\Api\Data\CacheTagInterfaceFactory;
@@ -22,11 +21,10 @@ class CacheTagRepository implements CacheTagRepositoryInterface
2221
protected $getByTag;
2322

2423
public function __construct(
25-
GetById $getById,
24+
GetById $getById,
2625
GetByTag $getByTag
2726
) {
28-
29-
$this->getById = $getById;
27+
$this->getById = $getById;
3028
$this->getByTag = $getByTag;
3129
}
3230

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: utietze
5+
* Date: 10.02.19
6+
* Time: 12:45
7+
*/
8+
9+
namespace Firegento\CacheWarmup\Service\Route;
10+
11+
12+
use Firegento\CacheWarmup\Api\Data\CacheRouteInterface;
13+
use Firegento\CacheWarmup\Api\Data\CacheRouteInterfaceFactory;
14+
15+
class NewRouteModelProvider
16+
{
17+
18+
/**
19+
* @var CacheRouteInterfaceFactory
20+
*/
21+
protected $cacheRouteInterfaceFactory;
22+
23+
public function __construct(CacheRouteInterfaceFactory $cacheRouteInterfaceFactory)
24+
{
25+
$this->cacheRouteInterfaceFactory = $cacheRouteInterfaceFactory;
26+
}
27+
28+
public function createForRoute(string $route, int $cacheStatus = 0, int $lifetime = 86400, int $popularity): CacheRouteInterface
29+
{
30+
/** @var CacheRouteInterface $freshCacheRoute */
31+
$freshCacheRoute = $this->cacheRouteInterfaceFactory->create();
32+
$freshCacheRoute->setRoute($route);
33+
$freshCacheRoute->setCacheStatus($cacheStatus);
34+
$freshCacheRoute->setLifetime($lifetime);
35+
$freshCacheRoute->setPopularity($popularity);
36+
37+
return $freshCacheRoute;
38+
}
39+
}

0 commit comments

Comments
 (0)