Drupal filters are not cacheable I have a Drupal 7 site with many custom filters. Everything works correctly, but not quick.
It looks as though the filter cache system does not work properly because the cache_filter table is always empty.
There is the issues in d.o. but it isn't replied.
The cache is used only when the input format is enabled to use it; this means that none of the input filters that are used by the input format disable the cache.

The code of check_markup(), which the function that is called when an input format needs to be applied to a text, contain the following code.

$cache = $cache &amp;&amp; !empty($format-&gt;cache);
$cache_id = '';
if ($cache) {
  $cache_id = $format-&gt;format . ':' . $langcode . ':' . hash('sha256', $text);
  if ($cached = cache_get($cache_id, 'cache_filter')) {
    return $cached-&gt;data;
  }
}


$cache is a parameter passed to the function, and $format is the variable containing the value returned by filter_format_load(); if $format-&gt;cache is FALSE, the filter cache will not be used.

In the case of the body content of a node, the function that is used to sanitize the body content (and the content of other fields) is _text_sanitize(), which invokes check_markup() without to use the fourth parameter ($cache), which by default is FALSE. This means that, whatever the filter is set to use the cache or not, the cache will not be used.

function _text_sanitize($instance, $langcode, $item, $column) {
  // If the value uses a cacheable text format, text_field_load() precomputes
  // the sanitized string.
  if (isset($item["safe_$column"])) {
    return $item["safe_$column"];
  }
  return $instance['settings']['text_processing'] ? check_markup($item[$column], $item['format'], $langcode) : check_plain($item[$column]);
}


This is different from what done by user_comment_view() (the implementation of hook_comment_view() that is used to filter out the signature of the user who wrote the comment), which passes the fourth parameter to check_markup(), setting it to TRUE.

function user_comment_view($comment) {
  if (variable_get('user_signatures', 0) &amp;&amp; !empty($comment-&gt;signature)) {
    // @todo This alters and replaces the original object value, so a
    //   hypothetical process of loading, viewing, and saving will hijack the
    //   stored data. Consider renaming to $comment-&gt;signature_safe or similar
    //   here and elsewhere in Drupal 8.
    $comment-&gt;signature = check_markup($comment-&gt;signature, $comment-&gt;signature_format, '', TRUE);
  }
  else {
    $comment-&gt;signature = '';
  }
}