HBPersistDriver
public protocol HBPersistDriver
Protocol for driver supporting persistent Key/Value pairs across requests
-
shutdown()
Default implementationshutdown driver
Default Implementation
default implemenation of shutdown()
Declaration
Swift
func shutdown()
-
create key/value pair. If key already exist throw
HBPersistError.duplicate
errorDeclaration
Swift
func create<Object>(key: String, value: Object, expires: TimeAmount?, request: HBRequest) -> EventLoopFuture<Void> where Object : Decodable, Object : Encodable
Parameters
key
Key to store value against
value
Codable value to store
expires
If non-nil defines time that value will expire
request
Request making this call
-
set value for key. If value already exists overwrite it
Declaration
Swift
func set<Object>(key: String, value: Object, expires: TimeAmount?, request: HBRequest) -> EventLoopFuture<Void> where Object : Decodable, Object : Encodable
Parameters
key
Key to store value against
value
Codable value to store
expires
If non-nil defines time that value will expire
request
Request making this call
-
get value for key
Declaration
Swift
func get<Object>(key: String, as: Object.Type, request: HBRequest) -> EventLoopFuture<Object?> where Object : Decodable, Object : Encodable
Parameters
key
Key used to look for value
as
Type you want value to be returned as. If it cannot be returned as this value then nil will be returned
request
Request making this call
-
remove value associated with key
Declaration
Swift
func remove(key: String, request: HBRequest) -> EventLoopFuture<Void>
Parameters
key
Key used to look for value
request
Request making this call