Standard library / crypto/tls
tls.NewLRUClientSessionCache()
Constructs a bounded concurrent-safe client session cache. Reuse it across compatible client connections to enable resumption. Expected stdout: 'false\n'.
Formal Syntax & Structure
go syntaxgo
func NewLRUClientSessionCache(capacity int) ClientSessionCacheParameters & Attributes
| Name | Type | Description |
|---|---|---|
| capacity | int | Maximum cache entries; nonpositive uses default capacity. |
Return Value
ClientSessionCache
Result of the operation; handle any returned error before using other results.
Working Example
Example Snippetgo
package main
import ( "crypto/tls" "fmt")
func main() { cache := tls.NewLRUClientSessionCache(4); _, ok := cache.Get("missing"); fmt.Println(ok) }
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}