code: def configure_materials_manager(graph, key_provider):
      
      if graph.config.materials_manager.enable_cache:
          return CachingCryptoMaterialsManager(
              cache=LocalCryptoMaterialsCache(graph.config.materials_manager.cache_capacity),
              master_key_provider=key_provider,
              max_age=graph.config.materials_manager.cache_max_age,
              max_messages_encrypted=graph.config.materials_manager.cache_max_messages_encrypted,
          )
      return DefaultCryptoMaterialsManager(master_key_provider=key_provider)
docs: Configure a crypto materials manager