Describe methods, speed up data retrieval. The task depends on the dialogue.
Условие
Заголовок раздела «Условие»Describe methods, speed up data retrieval. The task depends on the dialogue.
// building a weather app. Getting weather forecast by country.// Data updates come infrequently relative to reads and irregularly.// A 2-hour data lag is acceptable// The DB works poorly and slowly, 700-800ms
type database interface { get(ctx context.Context, key string) (string, error) save(ctx context.Context, key, value string) error}
type Repository struct { db database}
func (r *Repository) Get(ctx context.Context, key string) (string, error) { return r.db.get(ctx, key)}
func (r *Repository) Save(ctx context.Context, key, value string) error { return r.db.save(ctx, key, value)}Решение
Заголовок раздела «Решение»Источник: InDrive - 1
← Оценить алгоритмическую сложность. Как… · Все задачи · Алгоритмы и структуры данных · [Реализовать функцию isPalindrome (http… →