You are here

MailCacheBuild.php in Simplenews 3.x

Same filename and directory in other branches
  1. 8.2 src/Mail/MailCacheBuild.php
  2. 8 src/Mail/MailCacheBuild.php

File

src/Mail/MailCacheBuild.php
View source
<?php

namespace Drupal\simplenews\Mail;


/**
 * Source cache implementation that caches build and data element.
 *
 * @ingroup mail
 */
class MailCacheBuild extends MailCacheStatic {

  /**
   * {@inheritdoc}
   */
  public function isCacheable(MailInterface $mail, $group, $key) {

    // Only cache for anon users.
    if (\Drupal::currentUser()
      ->isAuthenticated()) {
      return FALSE;
    }

    // Only cache data and build information.
    return in_array($group, [
      'data',
      'build',
    ]);
  }

}

Classes

Namesort descending Description
MailCacheBuild Source cache implementation that caches build and data element.