github.com/gopherjs/gopherjs@v1.19.0-beta1.0.20240506212314-27071a8796e4/compiler/natives/src/crypto/internal/boring/bcache/cache.go (about) 1 //go:build js 2 // +build js 3 4 package bcache 5 6 import "unsafe" 7 8 // Cache relies on GC to periodically clear the cache. 9 // Since GopherJS doesn't have the same GC hooks, it currently can not 10 // register this cache with the GC. 11 // Without this cache Boring crypto, in particular public and private 12 // RSA and ECDSA keys, will be slower because the cache will always miss. 13 type Cache struct{} 14 15 func (c *Cache) Register() {} 16 func (c *Cache) Clear() {} 17 func (c *Cache) Get(k unsafe.Pointer) unsafe.Pointer { return nil } 18 func (c *Cache) Put(k, v unsafe.Pointer) {} 19 20 //gopherjs:purge 21 func (c *Cache) table() *[cacheSize]unsafe.Pointer 22 23 //gopherjs:purge 24 type cacheEntry struct{} 25 26 //gopherjs:purge 27 func registerCache(unsafe.Pointer) 28 29 //gopherjs:purge 30 const cacheSize = 1021