1// Copyright 2023 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package cmem 6 7import ( 8 "./aconfig" 9 "./bresource" 10) 11 12type MemT *int 13 14var G int 15 16type memResource struct { 17 x *int 18} 19 20func (m *memResource) initialize(*int) (res *int, err error) { 21 return nil, nil 22} 23 24func (m *memResource) teardown() { 25} 26 27func NewResource(cfg *aconfig.Config) *bresource.Resource[*int] { 28 res := &memResource{ 29 x: &G, 30 } 31 32 return bresource.New("Mem", res.initialize, bresource.ResConfig{ 33 // We always would want to retry the Memcache initialization. 34 ShouldRetry: func(error) bool { return true }, 35 TearDown: res.teardown, 36 }) 37} 38