feat: implement HashArray utility and refactor product key generation for Redis
This commit is contained in:
		@@ -25,6 +25,10 @@ type apiRepository struct {
 | 
			
		||||
	marketplaceRepository marketplace.Repository
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func GetProductsKey(identifier string) string {
 | 
			
		||||
	return fmt.Sprintf("wb:products:%s", identifier)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (a apiRepository) ParseMarketplace(ctx context.Context, marketplaceId int) (*marketplace.Marketplace, string, error) {
 | 
			
		||||
	marketplaceByID, err := a.marketplaceRepository.GetMarketplaceByID(ctx, marketplaceId)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -110,7 +114,7 @@ func (a apiRepository) StreamAllProductsCache(ctx context.Context, marketplaceId
 | 
			
		||||
 | 
			
		||||
	converter := generated.ConverterImpl{}
 | 
			
		||||
 | 
			
		||||
	key := fmt.Sprintf("wb:products:%s", identifier)
 | 
			
		||||
	key := GetProductsKey(identifier)
 | 
			
		||||
	var cachedMessage pb.GetProductsResponse
 | 
			
		||||
	err = redis.ReadProtoMessage(ctx, key, &cachedMessage)
 | 
			
		||||
	if err == nil && len(cachedMessage.Products) > 0 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user