I am fiddling a bit with drupal 8 cache. Looking at cache_page table and there is clearly a value with CID i am trying to fetch. I try this.

if ($item = \Drupal::cache()->get($cid)) {
  dsm($item);
}

and keep getting nothing for that CID, when I try some CID from cache_default. I get it without problem. So I am wondering how to get values from other tables?

up vote 4 down vote accepted

Provide the cache bin page, otherwise it defaults to default:

\Drupal::cache('page')->get($cid)
  • Of course. :) It was late in the evening and I knew there must be something like that, but didn't find any parameters in get function. – Marko Blazekovic Nov 19 at 8:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.