En pseudocódigo:
see if redis has the record by 'record_type:record_id'
if so return the result
if not then query postgres for the record_id in the record_type table
store the result in redis by 'record_type:record_id'
return the result
Es posible que tenga que ser un adaptador personalizado para el motor de consultas que está utilizando.