MCPcopy Index your code
hub / github.com/upper/db / NewCacheWithCapacity

Function NewCacheWithCapacity

internal/cache/cache.go:48–59  ·  view source on GitHub ↗

NewCacheWithCapacity initializes a new caching space with the given capacity.

(capacity int)

Source from the content-addressed store, hash-verified

46// NewCacheWithCapacity initializes a new caching space with the given
47// capacity.
48func NewCacheWithCapacity(capacity int) (*Cache, error) {
49 if capacity < 1 {
50 return nil, errors.New("Capacity must be greater than zero.")
51 }
52
53 c := &Cache{
54 capacity: capacity,
55 }
56
57 c.init()
58 return c, nil
59}
60
61// NewCache initializes a new caching space with default settings.
62func NewCache() *Cache {

Callers 1

NewCacheFunction · 0.85

Calls 2

initMethod · 0.95
NewMethod · 0.65

Tested by

no test coverage detected