Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache of module next previous (problem and solution) #1

Open
difayda opened this issue Aug 27, 2018 · 0 comments
Open

cache of module next previous (problem and solution) #1

difayda opened this issue Aug 27, 2018 · 0 comments

Comments

@difayda
Copy link

difayda commented Aug 27, 2018

thanks for sharing your code , i want to tell you about a cache problem in this model after a lot of search i found a solution , this is my solution :

  • i change the build function

public function build() {
$node = \Drupal::request()->attributes->get('node');
$created_time = 0;
if ($node instanceof \Drupal\node\NodeInterface) {
$created_time = $node->getCreatedTime();
}
$link = "";
$link .= $this->generatePrevious($created_time);
$link .= $this->generateNext($created_time);
$build = array();
$build['#markup'] = $link;
$build['#cache']['max-age'] = 0;
return $build;
}

@difayda difayda changed the title cache of module (problem and solution) cache of module next previous (problem and solution) Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant