You are here

class MailCacheBuild in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Mail/MailCacheBuild.php \Drupal\simplenews\Mail\MailCacheBuild
  2. 3.x src/Mail/MailCacheBuild.php \Drupal\simplenews\Mail\MailCacheBuild

Source cache implementation that caches build and data element.

Hierarchy

Expanded class hierarchy of MailCacheBuild

1 string reference to 'MailCacheBuild'
simplenews.services.yml in ./simplenews.services.yml
simplenews.services.yml
1 service uses MailCacheBuild
simplenews.mail_cache in ./simplenews.services.yml
Drupal\simplenews\Mail\MailCacheBuild

File

src/Mail/MailCacheBuild.php, line 10

Namespace

Drupal\simplenews\Mail
View source
class MailCacheBuild extends MailCacheStatic {

  /**
   * {@inheritdoc}
   */
  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, array(
      'data',
      'build',
    ));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MailCacheBuild::isCacheable function Return if the requested element should be cached. Overrides MailCacheStatic::isCacheable
MailCacheStatic::$cache protected property The static cache.
MailCacheStatic::get public function Return a cached element, if existing. Overrides MailCacheInterface::get
MailCacheStatic::getCid protected function Returns the cache identifier for the mail.
MailCacheStatic::set public function Write an element to the cache. Overrides MailCacheInterface::set