/// <inheritdoc /> public async ValueTask <Optional <Block> > GetBlockAsync(long guildId, string commandName) { var cachePackage = await cache.HashGetAsync <BlockCache>( CommandCacheKey, commandName + ":" + guildId); if (cachePackage != null) { await using var stream = new MemoryStream(cachePackage.Bytes); var reader = new BinaryReader(stream); return(reader.ReadBlock()); } var repository = unitOfWork.GetRepository <CustomCommand>(); var command = await repository.GetAsync(guildId, commandName); if (command == null) { return(Optional <Block> .None); } var block = BlockGenerator.Compile(command.CommandBody); await cache.HashUpsertAsync( CommandCacheKey, commandName + ":" + guildId, BlockCache.Create(block)); return(block); }