I really like the idea and was waiting for it ever since I used it in Laravel...

Contribution Date
Technology
Contribution Project
Contribution Details

I really like the idea and was waiting for it ever since I used it in Laravel. I also like how this is done with traits that can just be used in contrib modules.

Few points for review:

  1. The comment block on CacheRememberInterface is incorrect.
  2. I'd want this to be eventually added to the CacheBackendInterface in Drupal 9. Can we add a todo item for that?
  3. I'd want to follow the signature of set method in remember methods as well. Currently, it is $cid, $data, $expire, $tags, but the remember method is $cid, $expire, $callback, $tags. I realize you might have done it because $callback is a closure but I'd like to consider keeping the signature along the same pattern anyway, even if code appears like this:
    $data = $this->cache->remember($cid, function () { return 'My expensive value'; }, $expire);

    This is not unprecedented, BTW. Functions like array_map are written similarly.

  4. Can we use the phrase "Helper method" instead of "Shortcut" in docblocks for remember and rememberPermanent methods.
Contribution Author
Files count
0
Patches count
0