class MailCacheBuild in Simplenews 3.x
Same name and namespace in other branches
- 8.2 src/Mail/MailCacheBuild.php \Drupal\simplenews\Mail\MailCacheBuild
- 8 src/Mail/MailCacheBuild.php \Drupal\simplenews\Mail\MailCacheBuild
Source cache implementation that caches build and data element.
Hierarchy
- class \Drupal\simplenews\Mail\MailCacheStatic implements MailCacheInterface
- class \Drupal\simplenews\Mail\MailCacheBuild
Expanded class hierarchy of MailCacheBuild
1 string reference to 'MailCacheBuild'
1 service uses MailCacheBuild
File
- src/
Mail/ MailCacheBuild.php, line 10
Namespace
Drupal\simplenews\MailView source
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',
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MailCacheBuild:: |
public | function |
Return if the requested element should be cached. Overrides MailCacheStatic:: |
|
MailCacheStatic:: |
protected | property | The static cache. | |
MailCacheStatic:: |
public | function |
Return a cached element, if existing. Overrides MailCacheInterface:: |
|
MailCacheStatic:: |
protected | function | Returns the cache identifier for the mail. | |
MailCacheStatic:: |
public | function |
Write an element to the cache. Overrides MailCacheInterface:: |