EventLoopStorage

public final class EventLoopStorage

Extend EventLoopStorage using HBExtensions.

Use this to add additional data to each EventLoop in the application EventLoopGroup.

extension HBApplication.EventLoopStorage {
    var myVar: String {
        get { extensions.get(\.myVar) }
        set { extensions.set(\.myVar, value: newValue) }
    }
}

You can access the extension via HBApplication.eventLoopStorage(for: eventLoop).myVar or if you have an HBRequest you can access the extension via HBRequest.eventLoopStorage.myVar.

  • Allows you tp extend EventLoopStorage

    Declaration

    Swift

    public var extensions: HBExtensions<EventLoopStorage>