By moving the interface to the application-side (application.go
), you can still set the implementation-specific configuration details when you instantiate your library structs. If the interface was implemented on the library-side then you would need to provide:
type DB interface {
Get([]byte) ([]byte, error)
Put([]byte, []byte) error
CacheSize() int
SetCacheSize(int)