Introduction

A dynamic size concurrency-safe queue. At the same time, gqueue also supports fixed queue size, achieving efficiency comparable to the standard library’s channel when using a fixed queue size.

Usage Scenarios:

This queue is concurrency safe and is often used in scenarios where multiple goroutine data communication and dynamic queue size are supported.

How to Use:

  1. import "github.com/gogf/gf/v2/container/gqueue"

API Documentation:

https://pkg.go.dev/github.com/gogf/gf/v2/container/gqueue

Documentation

📄️ Queue - UsageUsing the gqueue component in the GoFrame framework for basic queue operations, including enqueuing and dequeuing elements, obtaining queue length, and closing the queue. It demonstrates in detail managing queue elements through Push and Pop methods and shows the relationship between the queue and glist linked list to ensure efficient construction of concurrency-safe program logic under the GoFrame framework.

📄️ Queue - PerformancePerformance testing of gqueue and the standard library channel in the GoFrame framework. Benchmark tests demonstrate gqueue’s advantages in dynamic storage and elastic capacity, showing better efficiency and flexibility in creation compared to the fixed memory allocation and capacity limitation of the channel.