Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nextjs
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
nextjs
Merge requests
!3
Issue
#3450070
: Implement post cache webhook event
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3450070
: Implement post cache webhook event
3450070-implement-post-cache
into
1.0.x
Overview
0
Commits
1
Pipelines
2
Changes
2
Merged
Christian Foidl
requested to merge
3450070-implement-post-cache
into
1.0.x
11 months ago
Overview
0
Commits
1
Pipelines
2
Changes
2
Expand
Closes
#3450070
0
0
Merge request reports
Compare
1.0.x
1.0.x (base)
and
latest version
latest version
8faa9c3c
1 commit,
11 months ago
2 files
+
57
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
src/Event/CacheWebhookResponseEvent.php
0 → 100644
+
50
−
0
Options
<?php
namespace
Drupal\nextjs\Event
;
use
Psr\Http\Message\ResponseInterface
;
use
Symfony\Contracts\EventDispatcher\Event
;
/**
* Event when a cache webhook was sent.
*/
class
CacheWebhookResponseEvent
extends
Event
{
const
EVENT_NAME
=
'nextjs.cache_webhook_response'
;
/**
* Construct new event.
*/
public
function
__construct
(
protected
string
$url
,
protected
ResponseInterface
$response
,
protected
\DateTime
$dateTime
,
)
{}
/**
* If webhook was processed successfully.
*/
public
function
isSuccess
():
bool
{
return
$this
->
response
->
getStatusCode
()
===
200
;
}
/**
* Get HTTP response.
*/
public
function
getResponse
():
ResponseInterface
{
return
$this
->
response
;
}
/**
* Get time when webhook was processed by Next.js.
*
* This is useful, e.g. if you need to make sure the cache
* revalidation is fully propagated (add 300ms to this time).
*
* @see https://vercel.com/docs/infrastructure/data-cache#revalidation-behavior
*/
public
function
getProcessedTime
():
\DateTime
{
return
$this
->
dateTime
;
}
}
Loading