efritz/gache

View on GitHub
memory_options.go

Summary

Maintainability
A
0 mins
Test Coverage
package gache

// MemoryConfig is a function use dot configure instances of a
// Cache which uses a memory backend.
type MemoryConfig func(*memoryCache)

// WithMemoryCapacity sets the maximum number of items which are
// able to be stored in the memory backend.
func WithMemoryCapacity(capacity int) MemoryConfig {
    return func(rc *memoryCache) { rc.capacity = capacity }
}