'Returns the number of seconds (from Â«response_timestampÂ») that this
placeholder can be cached. This is derived from the plugins it contains.
This method must return: EXPIRE_NOW <= int <= MAX_EXPIRATION_IN_SECONDS
:type request: HTTPRequest
:type response_timestamp: datetime
:rtype: int'

def get_cache_expiration(self, request, response_timestamp):

    min_ttl = MAX_EXPIRATION_TTL
    if ((not self.cache_placeholder) or (not get_cms_setting('PLUGIN_CACHE'))):
        return EXPIRE_NOW
    def inner_plugin_iterator(lang):
        "\n                                                The    placeholder    will    have    a    cache    of    all    the    concrete    plugins    it\n                                                uses    already,    but    just    in    case    it    doesn't,    we    have    a    code-path    to\n                                                generate    them    anew.\n\n                                                This    is    made    extra    private    as    an    inner    function    to    avoid    any    other\n                                                process    stealing    our    yields.\n                                                "
        if hasattr(self, '_all_plugins_cache'):
            for instance in self._all_plugins_cache:
                plugin = instance.get_plugin_class_instance()
                (yield (instance, plugin))
        else:
            for plugin_item in self.get_plugins(lang):
                (yield plugin_item.get_plugin_instance())
    language = get_language_from_request(request, self.page)
    for (instance, plugin) in inner_plugin_iterator(language):
        plugin_expiration = plugin.get_cache_expiration(request, instance, self)
        if (plugin_expiration is None):
            continue
        if isinstance(plugin_expiration, (datetime, timedelta)):
            if isinstance(plugin_expiration, datetime):
                try:
                    delta = (plugin_expiration - response_timestamp)
                except TypeError:
                    warnings.warn(('Plugin    %(plugin_class)s    (%(pk)d)    returned    a    naive    datetime    :    %(value)s    for    get_cache_expiration(),    ignoring.' % {'plugin_class': plugin.__class__.__name__, 'pk': instance.pk, 'value': force_text(plugin_expiration)}))
                    continue
            else:
                delta = plugin_expiration
            ttl = int((delta.total_seconds() + 0.5))
        else:
            try:
                ttl = int(plugin_expiration)
            except ValueError:
                warnings.warn(('Plugin    %(plugin_class)s    (%(pk)d)    returned    unexpected    value    %(value)s    for    get_cache_expiration(),    ignoring.' % {'plugin_class': plugin.__class__.__name__, 'pk': instance.pk, 'value': force_text(plugin_expiration)}))
                continue
        min_ttl = min(ttl, min_ttl)
        if (min_ttl <= 0):
            return EXPIRE_NOW
    return min_ttl
