How does Craft CMS cache with Redis? I don't understand how Craft CMS processes cache with Redis especially when saving to database/s?
My environment:

Craft Pro 3.4.8
PostgreSQL 12.2
PHP-FPM 7.4.3
Redis 5.0.7

I followed examples from the Application Configuration documentation and It seems that Craft CMS works well Redis. From inspecting both databases, sessions and queue work as expected.

queue table is created in SQL DB but empty because all queue related storage is moved to Redis where I can see all the keys queue.message_id, queue.messages and queue.waiting. queue table will probably always stay in SQL DB from installation process.
when a session begins token value is created in sessions table in SQL DB with some session related attributes and I also could locate the same token key-value in Redis DB with additional info about current session. When session ended token was removed from both databases.

Cache
I created some matrix field content and I cached it.
I found out that a row with cacheKey and other attributes (along with body column) are created in templatecaches table in SQL DB.
Since using Redis I expected that all/most of cache related storage will be stored in Redis. Inspecting Redis and I couldn't find anything to cache related stuff.
Craft only stores a small number of things in the Cache. As per this article (disclosure: written by myself) the things Craft will add to a Redis backed data cache are:


Available updates
Plugin store data
GraphQL query results
Some bits of data from the Craft Net API including license information
Project Config modification timestamps
Any data which is explicitly cached by plugins you have installed


Craft doesn't store any data which is cached using twig {% cache %} tags in the Redis backed data cache. The reason for this is discussed here but it boils down to the fact that Craft maintains a relationship between element queries inside the cache block and the cache results. This allows edits to specific elements to be traced back to all of the cache blocks that they might impact and should therefore be cleared.
Brandon puts it a little more succinctly:

[it] provides the most efficient cache-busting logic

Update 8th Sept 2020
Craft 3.5 now stores its {% cache %} tag data in the default data cache configured for Craft. If you are using Redis as Craft's data cache your template caches will now be placed there.
It also moves the cache busting logic out of the database and instead uses Yii's tag based cache invalidation. These changes should be significantly more performant and prevent previous issues with background tasks trying to clean up too many cache entries held in the database.