How to retrieve cookie – Drupal Answers


In D8 Project, Cookie save p-nid1, p-nid2, p-nid3 (1, 2, 3 is node id). Cookie save with Drupal.visitor.p-nid1, Drupal.visitor.p-nid2, Drupal.visitor.p-nid3. But when get cookie

$nid = $node->id();
$cookieName = 'p-nid'.$nid;
$getCookieVal = Drupal::request()->cookies->get('Drupal_visitor_'.$cookieName);

Cookie not retrieve.
When doing clear chache the cookie retrieve.
I also disable module Internal Page Cache.
My question how to retrieve cookie without clear Cache for Anonymous.