Movatterモバイル変換


[0]ホーム

URL:


bcache

packagestandard library
go1.25.2Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2025 License:BSD-3-Clause, BSD-3-Clause, ISC, + 1 moreImports:2Imported by:0

Details

Repository

cs.opensource.google/go/go

Links

Documentation

Overview

Package bcache implements a GC-friendly cache (seeCache) for BoringCrypto.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeCache

type Cache[K, Vany] struct {// contains filtered or unexported fields}

A Cache is a GC-friendly concurrent map from unsafe.Pointer tounsafe.Pointer. It is meant to be used for maintaining shadowBoringCrypto state associated with certain allocated structs, inparticular public and private RSA and ECDSA keys.

The cache is GC-friendly in the sense that the keys do notindefinitely prevent the garbage collector from collecting them.Instead, at the start of each GC, the cache is cleared entirely. Thatis, the cache is lossy, and the loss happens at the start of each GC.This means that clients need to be able to cope with cache entriesdisappearing, but it also means that clients don't need to worry aboutcache entries keeping the keys from being collected.

func (*Cache[K, V])Clear

func (c *Cache[K, V]) Clear()

Clear clears the cache.The runtime does this automatically at each garbage collection;this method is exposed only for testing.

func (*Cache[K, V])Get

func (c *Cache[K, V]) Get(k *K) *V

Get returns the cached value associated with v,which is either the value v corresponding to the most recent call to Put(k, v)or nil if that cache entry has been dropped.

func (*Cache[K, V])Put

func (c *Cache[K, V]) Put(k *K, v *V)

Put sets the cached value associated with k to v.

func (*Cache[K, V])Register

func (c *Cache[K, V]) Register()

Register registers the cache with the runtime,so that c.ptable can be cleared at the start of each GC.Register must be called during package initialization.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp