Skip to content

Commit

Permalink
Merge pull request #119 from jingu/1.x
Browse files Browse the repository at this point in the history
Changed to preserve Surrogate-Key held by ResourceObject at entry point
  • Loading branch information
koriym committed Jul 25, 2022
2 parents 1283e07 + 2d28fcf commit 40a0906
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/DonutRepository.php
Expand Up @@ -61,6 +61,7 @@ public function putStatic(ResourceObject $ro, ?int $ttl = null, ?int $sMaxAge =
{
$this->logger->log('put-donut: uri:%s ttl:%s s-maxage:%d', (string) $ro->uri, $sMaxAge, $ttl);
$keys = new SurrogateKeys($ro->uri);
$keys->addTag($ro);
$headerKeys = $this->getHeaderKeys($ro);
$donut = ResourceDonut::create($ro, $this->renderer, $keys, $sMaxAge, true);
$donut->render($ro, $this->renderer);
Expand Down
4 changes: 2 additions & 2 deletions tests/DonutQueryInterceptorTest.php
Expand Up @@ -88,8 +88,8 @@ public function testCached(): void
save-etag uri:page://self/html/comment etag:_html_comment_ surrogate-keys:comment01 _html_comment_
save-value uri:page://self/html/comment tags:_html_comment_ comment01 ttl:31536000
invalidate-etag tags:_html_blog-posting_
save-etag uri:page://self/html/blog-posting etag:_html_blog-posting_ surrogate-keys:_html_blog-posting_ _html_comment_ comment01
save-donut-view uri:page://self/html/blog-posting surrogate-keys:_html_blog-posting_ _html_comment_ comment01 s-maxage:
save-etag uri:page://self/html/blog-posting etag:_html_blog-posting_ surrogate-keys:blog-posting-page _html_blog-posting_ _html_comment_ comment01
save-donut-view uri:page://self/html/blog-posting surrogate-keys:_html_blog-posting_ blog-posting-page _html_comment_ comment01 s-maxage:
save-donut uri:page://self/html/blog-posting s-maxage:
get
try-donut-view: uri:page://self/html/blog-posting
Expand Down
1 change: 1 addition & 0 deletions tests/Fake/fake-app/src/Resource/Page/Html/BlogPosting.php
Expand Up @@ -25,6 +25,7 @@ public function onGet(int $id = 0)
$this->body += [
'article' => '1'
];
$this->headers[Header::SURROGATE_KEY] = 'blog-posting-page';

return $this;
}
Expand Down

0 comments on commit 40a0906

Please sign in to comment.