Cache/RequestLastModifiedCache.php
public function onEntryUpdate(ContentfulEntryEvent $e)
    {
        $entry             = $e->getEntry();
        $key               = $this->getCacheKeyItem($entry->getId(), 'uri');
        $urisForItemOption = Option::fromValue($this->cache->fetch($key), false);
        if ($urisForItemOption->isEmpty()) {
            Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($entry) {
                $logger->debug(sprintf('[ContentfulBundle:RequestLastModifiedCache] Entry "%s" is not used.', $entry->getId()));
            });
            return;
        }
        // Update
        $urisForItem = $urisForItemOption->get();
        foreach ($urisForItem as $uri => $bool) {
            $key          = $this->getCacheKeyRequest(sha1($uri), 'lastmodified');
            $lastModified = $this->cache->fetch($key);
            if ($lastModified >= $entry->getUpdatedAt()->format('r')) {
                Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($lastModified, $uri) {
                    $logger->debug(sprintf('[ContentfulBundle:RequestLastModifiedCache] "%s" was last modified at "%s". Entry is older.', $uri, $lastModified));
                });
                continue;
            }
            $this->cache->save($key, $entry->getUpdatedAt()->format('r'));
            Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($entry, $uri) {
                $logger->debug(sprintf('[ContentfulBundle:RequestLastModifiedCache] Setting last modified time for "%s" to "%s".', $uri, $entry->getUpdatedAt()->format('r')));
            });
        }
    }
public function onEntryUpdate(ContentfulEntryEvent $e)
    {
        $entry             = $e->getEntry();
        $key               = $this->getCacheKeyItem($entry->getId(), 'uri');
        $urisForItemOption = Option::fromValue($this->cache->fetch($key), false);
        if ($urisForItemOption->isEmpty()) {
            Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($entry) {
                $logger->debug(sprintf('[ContentfulBundle:RequestLastModifiedCache] Entry "%s" is not used.', $entry->getId()));
            });
            return;
        }
        // Update
        $urisForItem = $urisForItemOption->get();
        foreach ($urisForItem as $uri => $bool) {
            $key          = $this->getCacheKeyRequest(sha1($uri), 'lastmodified');
            $lastModified = $this->cache->fetch($key);
            if ($lastModified >= $entry->getUpdatedAt()->format('r')) {
                Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($lastModified, $uri) {
                    $logger->debug(sprintf('[ContentfulBundle:RequestLastModifiedCache] "%s" was last modified at "%s". Entry is older.', $uri, $lastModified));
                });
                continue;
            }
            $this->cache->save($key, $entry->getUpdatedAt()->format('r'));
            Option::fromValue($this->logger)->map(function (LoggerInterface $logger) use ($entry, $uri) {
                $logger->debug(sprintf('[ContentfulBundle:RequestLastModifiedCache] Setting last modified time for "%s" to "%s".', $uri, $entry->getUpdatedAt()->format('r')));
            });
        }
    }
This method gets called when an Entry is update and updates the
last modified time cache entry for every page it is used.

There is a problem with this implementation: adding _new_ child elements
is not picked up because they were never used before.

@param ContentfulEntryEvent $e