Automattic\WooCommerce\Admin\RemoteInboxNotifications
RemoteInboxNotificationsDataSourcePoller::save_published_snapshot
Store a read's publication evidence unless a newer read is already stored.
Method of the class: RemoteInboxNotificationsDataSourcePoller{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->save_published_snapshot( $fetched_at, ?array $slugs ): void;
- $fetched_at(int) (required)
- When the read started.
- ?array $slugs(required)
- .
RemoteInboxNotificationsDataSourcePoller::save_published_snapshot() RemoteInboxNotificationsDataSourcePoller::save published snapshot code WC 11.3.0
private function save_published_snapshot( int $fetched_at, ?array $slugs ): void {
$stored = get_transient( self::PUBLISHED_SNAPSHOT_TRANSIENT );
if ( is_array( $stored ) && is_int( $stored['fetched_at'] ?? null ) && $stored['fetched_at'] > $fetched_at ) {
return;
}
set_transient(
self::PUBLISHED_SNAPSHOT_TRANSIENT,
array(
'fetched_at' => $fetched_at,
'slugs' => $slugs,
),
$this->args['transient_expiry']
);
}